我在VB 6.0中创建了一个Internet浏览器,我给它一个进度条... 当输入链接并点击“GO”后。进度条的按钮值开始增加,但当它完全填满时,ERROR会出现.. 运行时错误'380': 无效的属性值。
Private Sub Command1_Click()
WebBrowser1.Navigate Text1.Text
End Sub
Private Sub Command2_Click()
WebBrowser1.GoBack
End Sub
Private Sub Command3_Click()
WebBrowser1.GoForward
End Sub
Private Sub menuchangetheme_Click()
CDB1.ShowColor
Form1.BackColor = CDB1.Color
End Sub
Private Sub menuexit_Click()
End
End Sub
Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
ProgressBar1.Value = 0
If ProgressBar1.Value <> Val(ProgressBar1.Max) Then
ProgressBar1.Value = ProgressBar1.Value + Val(Progress)
ProgressBar1.Max = ProgressBar1.Value + 1
Else
ProgressBar1.Value = 0
End If
End Sub
答案 0 :(得分:0)
参数进度和 ProgressMax 已经是数字,因此您无需转换它们。正如Deanna指出的那样,您的代码正在向Progressbar的Value添加Progress。发生此错误的原因是您尝试分配的值大于进度条最大属性。
Private Sub WebBrowser1_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
On Local Error Resume Next 'suppress errors because they are not important enough to display to user
If Progress > 0 Then 'the page download is not complete
ProgressBar1.Min = 0 'not really needed, but also doesn't hurt to set it here
ProgressBar1.Max = ProgressMax + 1 'needs to be set because the ProgressMax can change every time the event is raised
ProgressBar1.Value= Progress 'set the displayed value of the progressbar
Else
ProgressBar1.Value = 0 'the page load is finished
End If
End Sub