| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 546 人关注过本帖
标题:请大神帮看看
只看楼主 加入收藏
角角鱼
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-12-4
收藏
 问题点数:0 回复次数:1 
请大神帮看看
红色部分为不清楚的部分,那位知道在那里改?先谢谢了,(目前其他的功能基本上都实现了)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Try
            BackgroundWorker1.RunWorkerAsync()
           我该在哪里确定progeessbar的最大值?目前我乱放在这的
            ProgressBar1.Maximum = 1000000
            While Me.BackgroundWorker1.IsBusy
                Application.DoEvents()
            End While
        Catch ex As Exception
            MessageBox.Show(ex.Message.ToString())
        End Try

    End Sub

    Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As ) Handles BackgroundWorker1.DoWork
        Dim url As String = "http://www.
        Try
            Dim resquert As WebRequest = HttpWebRequest.Create(url)
             = 512
            resquert.Timeout = 500
            Dim response As HttpWebResponse = resquert.GetResponse()
            Dim length As Long = response.ContentLength
             '曾经在将progressbar的MAX值放在这,但报错
            Do
                Dim nread As Integer
                Dim readbuffer(4096) As Byte
                Dim readbyte As Long = response.GetResponseStream.Read(readbuffer, 0, 4096)
                nread += readbyte
                BackgroundWorker1.ReportProgress(nread)
                If readbyte = 0 Then Exit Do
            Loop
        Catch ex As Exception
            MessageBox.Show(ex.Message.ToString())
        End Try

    End Sub


    Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As System.Object, ByVal e As ) Handles BackgroundWorker1.ProgressChanged
        ProgressBar1.Value = e.ProgressPercentage
        Label1.Text = ProgressBar1.Value
    End Sub
搜索更多相关主题的帖子: 最大值 其他 
2013-01-13 23:28
角角鱼
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-12-4
收藏
得分:0 
注:那个100000是我自己乱加上的
2013-01-13 23:29
快速回复:请大神帮看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023745 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved