需要帮助进度条 [英] Need Help with Progress Bar

查看:56
本文介绍了需要帮助进度条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写的代码不工作有什么问题?


私有子Command1_Click()

如果按下Command1然后启动ProgressBar1

结束子


'是开始进度条但是没有。


另外你知道如何自动加载MDI表单或frmBrowser表单的网页。这里是frmbrowser表单的代码。


选项明确


Public StartingAddress As String

Dim mbDontNavigateNow As Boolean

Private Sub Form_Load()

On Error Resume Next

Me.Show

tbToolBar.Refresh

Form_Resize


cboAddress.Move 50,lblAddress.Top + lblAddress.Height + 15


如果Len(StartingAddress)> ; 0然后

cboAddress.Text = StartingAddress

cboAddress.AddItem cboAddress.Text

''尝试导航到起始地址

timTimer.Enabled = True

brwWebBrowser.Navigate StartingAddress

结束如果


End Sub




Private Sub brwWebBrowser_DownloadComplete()

On Error Resume Next

Me.Caption = brwWebBrowser.LocationName

End Sub


Private Sub brwWebBrowser_NavigateComplete(ByVal URL As String)

Dim i As Integer

Dim bFound作为布尔值

Me.Caption = brwWebBrowser.LocationName

For i = 0 to cboAddress.ListCount - 1

if cboAddress.List(i) = brwWebBrowser.LocationURL然后

bFound =真

退出

结束如果

下一页我

mbDontNavigateNow =真如果

如果bFound那么

cboAddress.RemoveItem i

结束如果

cboAddress.AddItem brwWebBrowser.LocationURL,0

cboAddress.ListIndex = 0

mbDontNavigateNow = False

End Sub


Private Sub cboAddress_Click( )

如果mbDontNavigateNow然后退出Sub

timTimer.Enabled = True

brwWebBrowser.Navigate cboAddress.Text

结束Sub $ />

Private Sub cboAddress_KeyPress(KeyAscii As Integer)

On Error Resume Next

如果KeyAscii = vbKeyReturn那么

cboAddress_Click

结束如果

结束子


私人子Form_Resize()

cboAddress.Width = Me.ScaleWidth - 100

brwWebBrowser.Width = Me.ScaleWidth - 100

brwWebBrowser.Height = Me.ScaleHeight - (picAddress.Top + picAddress.Height ) - 100

End Sub


Privat e Sub picAddress_Click()


End Sub


Private Sub timTimer_Timer()

如果brwWebBrowser.Busy = False然后

timTimer.Enabled = False

Me.Caption = brwWebBrowser.LocationName

否则

Me.Caption = 工作......

结束如果

结束子


私有子tbToolBar_ButtonClick(ByVal按钮为按钮)

On Error Resume Next


timTimer.Enabled = True


Select Case Button.Key

案例返回

brwWebBrowser.GoBack

案例转发

brwWebBrowser.GoForward

案例刷新

brwWebBrowser.Refresh

案例主页

brwWebBrowser.GoHome

案例搜索

brwWebBrowser。 GoSearch

Case" Stop"

timTimer.Enabled = False

brwWebBrowser.Stop

Me.Caption = brwWebBrowser.LocationName

结束选择


结束子


和Mdi表格在这里是。



私人子MDIForm_Load()


结束子


我在做什么这是在我的业余时间所以你不必快点请和谢谢你

来自尤达和加拿大所有的呃!

Code for that i made up doesn''t work whats wrong?

Private Sub Command1_Click()
If Command1 Is pressed Then start ProgressBar1
End Sub

that''s to start the progress bar but it doesn''t.

Also do you know how to auto load a web page with MDI form or the frmBrowser form. Here the code for the frmbrowser form.

Option Explicit

Public StartingAddress As String
Dim mbDontNavigateNow As Boolean
Private Sub Form_Load()
On Error Resume Next
Me.Show
tbToolBar.Refresh
Form_Resize

cboAddress.Move 50, lblAddress.Top + lblAddress.Height + 15

If Len(StartingAddress) > 0 Then
cboAddress.Text = StartingAddress
cboAddress.AddItem cboAddress.Text
''try to navigate to the starting address
timTimer.Enabled = True
brwWebBrowser.Navigate StartingAddress
End If

End Sub



Private Sub brwWebBrowser_DownloadComplete()
On Error Resume Next
Me.Caption = brwWebBrowser.LocationName
End Sub

Private Sub brwWebBrowser_NavigateComplete(ByVal URL As String)
Dim i As Integer
Dim bFound As Boolean
Me.Caption = brwWebBrowser.LocationName
For i = 0 To cboAddress.ListCount - 1
If cboAddress.List(i) = brwWebBrowser.LocationURL Then
bFound = True
Exit For
End If
Next i
mbDontNavigateNow = True
If bFound Then
cboAddress.RemoveItem i
End If
cboAddress.AddItem brwWebBrowser.LocationURL, 0
cboAddress.ListIndex = 0
mbDontNavigateNow = False
End Sub

Private Sub cboAddress_Click()
If mbDontNavigateNow Then Exit Sub
timTimer.Enabled = True
brwWebBrowser.Navigate cboAddress.Text
End Sub

Private Sub cboAddress_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = vbKeyReturn Then
cboAddress_Click
End If
End Sub

Private Sub Form_Resize()
cboAddress.Width = Me.ScaleWidth - 100
brwWebBrowser.Width = Me.ScaleWidth - 100
brwWebBrowser.Height = Me.ScaleHeight - (picAddress.Top + picAddress.Height) - 100
End Sub

Private Sub picAddress_Click()

End Sub

Private Sub timTimer_Timer()
If brwWebBrowser.Busy = False Then
timTimer.Enabled = False
Me.Caption = brwWebBrowser.LocationName
Else
Me.Caption = "Working..."
End If
End Sub

Private Sub tbToolBar_ButtonClick(ByVal Button As Button)
On Error Resume Next

timTimer.Enabled = True

Select Case Button.Key
Case "Back"
brwWebBrowser.GoBack
Case "Forward"
brwWebBrowser.GoForward
Case "Refresh"
brwWebBrowser.Refresh
Case "Home"
brwWebBrowser.GoHome
Case "Search"
brwWebBrowser.GoSearch
Case "Stop"
timTimer.Enabled = False
brwWebBrowser.Stop
Me.Caption = brwWebBrowser.LocationName
End Select

End Sub

and For the Mdi Form here it is.


Private Sub MDIForm_Load()

End Sub

I''m doing this in my spare time so you don''t have to hurry Please and Thank you
From Yoda and all of Canada Eh!

推荐答案


我编写的代码不工作有什么问题?


Private Sub Command1_Click()
如果按下了Command1然后启动ProgressBar1

结束子


即启动进度条,但它没有。
Code for that i made up doesn''t work whats wrong?

Private Sub Command1_Click()
If Command1 Is pressed Then start ProgressBar1
End Sub

that''s to start the progress bar but it doesn''t.



这是您尝试执行的实际代码吗?如果这是VB6那么我会非常看到它通过语法检查。我不认为开始甚至是一个声明,尽管你可以创建一个名为start的子语句。并调用它。


无论如何,你不是开始进度条。从放置在表单上的那一刻起,它始终显示(假设它是可见的)适合当前 .Value 属性中的值。那么当点击这个按钮时你真的想用它做什么?将它设置回零?


请记住,进度条实际上并没有 任何进度跟踪 你。它只显示您提供的信息,但作为条形而不是文本。因此,如果您希望它显示某些任务的进度,您需要先适当地设置 .Min .Max (我相信它们分别默认为0和100,方便显示百分比)并确保 .Value 设置为与 .Min 相同。然后,当您完成任务时,将 .Value 设置为逐渐更高的值,直到它在任务结束时达到 .Max

如果你谈论VB6,那就忘掉我说的一切。

Is that the actual code you are trying to execute? If this is VB6 then I''d be very surprised to see it pass the syntax-check. I don''t think "start" is even a statement, though you could create a sub called "start" and invoke that.

Anyway, you don''t start a progress bar. From the moment it is placed on your form, it always displays (assuming it''s visible) whatever is appropriate to the value currently in its .Value property. So what do you actually want to do with it when this button is clicked? Set it back to zero?

Keep in mind, the progress bar doesn''t actually do any progress tracking for you. It just displays the information you give it, but as a bar instead of text. So if you want it to show the progress of some task, you need to first set .Min and .Max appropriately (I believe they default to 0 and 100 respectively, which is convenient for showing a percentage) and ensure .Value is set to the same as .Min. Then as you go through the task, you set .Value to progressively higher values, until it reaches .Max at the end of the task.

If you are not talking about VB6, then forget everything I said.


谢谢,但可以放入lam勒芒术语,善待得到什么你的谚语,但会把它放在代码中。


示例:

Private Sub Command1_Click()

如果单击Command1,则.Min = 0

如果单击Command1,则.max = 100

结束子


是这样的,只是一个客人,因为正确知道我在我的电脑没有
有vb 6.0(我在我的iMac上)。我也有一个问题,VB是否来自mac。
Thanks, but could put in lam mans terms, kind get what your saying but would put itin code.

Example:
Private Sub Command1_Click()
If Command1 Is Clicked then .Min = 0
If Command1 is clicked then .max = 100
End Sub

is it like that, just a guest, because right know i''m on my computer that doesn''t
have vb 6.0 (i''m on my iMac). I''ve also got a question does VB come for mac or not.



谢谢,但可以放入lam mans术语,kind得到你的意思,但会把它放在代码中。


示例:

Private Sub Command1_Click()

如果单击Command1,则.Min = 0

如果单击Command1,则.max = 100

结束子


是这样的,只是一个客人,因为正确知道我在我的电脑没有
有vb 6.0(我在我的iMac上)。我也有一个问题,VB是否来自mac。
Thanks, but could put in lam mans terms, kind get what your saying but would put itin code.

Example:
Private Sub Command1_Click()
If Command1 Is Clicked then .Min = 0
If Command1 is clicked then .max = 100
End Sub

is it like that, just a guest, because right know i''m on my computer that doesn''t
have vb 6.0 (i''m on my iMac). I''ve also got a question does VB come for mac or not.



我不认为VB适用于Mac,虽然我相信你现在可以在Mac上运行Windows,所以这将是一种方式。可能没有太多的帮助。


我得到的印象是你正在努力解决VB(以及许多其他语言)的事件驱动性质。首先,Command1_Click例程仅在用户单击Command1 时执行。所以没有必要尝试检测它是否被点击。


试试这个......

I don''t think VB is available for Mac, though I believe you can actually run Windows on the Mac now, so that would be one way. Probably not a lot of help, though.

I get the impression that you are struggling with the event-driven nature of VB (and lots of other languages). For a start, the Command1_Click routine is only executed when the user clicks Command1. So there is no need to try to detect whether it was clicked.

Try this...

展开 | 选择 | 换行 | 行号


这篇关于需要帮助进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆