|
-
Oct 4th, 2006, 08:13 AM
#1
Thread Starter
Hyperactive Member
Progress Bar
Anyone have a good example of how to use a progress bar to show the status of a For Loop?
-
Oct 4th, 2006, 08:26 AM
#2
Banned
Re: Progress Bar
Huh?
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim iCount As UInteger
iCount = 32600
Me.ProgressBar1.Maximum = iCount
For i As Integer = 0 To iCount - 1
Me.ProgressBar1.Value += 1
Next
End Sub
-
Oct 4th, 2006, 08:31 AM
#3
Re: Progress Bar
 Originally Posted by JAKSupport
Huh?
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim iCount As UInteger
iCount = 32600
Me.ProgressBar1.Maximum = iCount
For i As Integer = 0 To iCount - 1
Me.ProgressBar1.Value += 1
Next
End Sub
Any reason why you used a UInteger versus a regular Integer?
-
Oct 4th, 2006, 08:49 AM
#4
Thread Starter
Hyperactive Member
Re: Progress Bar
so where exactly does this progressbar showup? whats a good x y position to set it to?
-
Oct 4th, 2006, 08:50 AM
#5
Re: Progress Bar
that really depends on your GUI...
You didn't state what you are trying to do, you just asked how to make a progress bar show a loops status
-
Oct 4th, 2006, 08:55 AM
#6
Thread Starter
Hyperactive Member
Re: Progress Bar
well i added the code and it appears nothing at all happens..
VB Code:
Dim progressbar As New ProgressBar
progressbar.Maximum = tmpInt
progressbar.Value = 0
For x = 0 To tmpInt
locid = dgCustomers.Item(0, x).Value
If locid = Nothing Then
Exit For
Else
result = calc.VerifyCustomer(locid)
If result = False Then
company = dgCustomers.Item(1, x).Value
If company = "" Or company = Nothing Then
company = "Uknown"
End If
contact = dgCustomers.Item(2, x).Value & dgCustomers.Item(3, 1).Value
If contact = "" Or contact = Nothing Then
contact = "Uknown"
End If
If Not dgCustomers.Item(4, x).Value.ToString.Length > 0 Then
phone = "Unknown"
Else
phone = dgCustomers.Item(4, x).Value
End If
calc.InsertCustomer(locid, company, phone, contact)
End If
End If
progressbar.Value += 1
Next
-
Oct 4th, 2006, 09:09 AM
#7
Re: Progress Bar
Don't declare the progress bar in your code, add it to your form using the toolbox.
You could add it in code, but you would have to add several other lines of code where adding it from the toolbox will handle adding all that code for you.
-
Oct 4th, 2006, 09:25 AM
#8
Banned
Re: Progress Bar
 Originally Posted by kleinma
Any reason why you used a UInteger versus a regular Integer?
Heh ..well it is unsigned, you never want the maximum to be less than 0 .
Otherwise no reason..you could used int .
-
Oct 4th, 2006, 09:34 AM
#9
Banned
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|