|
-
Nov 14th, 2005, 07:52 AM
#1
Thread Starter
Lively Member
[RESOLVED] Beginner needs a progress bar
I have little knowledge of visual basic so feel free to reply as if im stupid. Any way i have some how created a simple ping application but need to add a progress bar to reassure users. Could any one help in showing me what code i need to add and where.
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ComboBox.Text = "Hull MPLS" Then
Dim p As New Process
p.StartInfo.FileName = "ping.exe"
p.StartInfo.Arguments = "172.16.0.1"
p.StartInfo.CreateNoWindow = True
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
p.Start()
With TextBox
.Text = .Text & p.StandardOutput.ReadToEnd
.SelectionStart = Len(.Text)
.ScrollToCaret()
End With
p.WaitForExit()
End If
Thanks
Jason
-
Nov 14th, 2005, 07:55 AM
#2
Lively Member
Re: Beginner needs a progress bar
Drag a progress bar onto your form and name it as appropriate. For the sake of reference i will call it progressBar1. The progress bar exposes the property maximum (max number of increments) and the method increment()
set the max number of increments - eg if you perform 10 pings
ProgressBar1.maximum = 10
then for each ping you perform progressBar1.increment(1)
hope this helps
-
Nov 14th, 2005, 07:59 AM
#3
Re: Beginner needs a progress bar
You can't really display a traditional progress bar unless you can give some indication of exactly what the progress is, which in your case you can't. Plus the fact that your app is frozen until WaitForExit returns. If you are using VB.NET 2005 then the ProgressBar has a Style property that you can set to Marquee to create an endless ProgressBar like the one displayed when Windows starts up.
-
Nov 14th, 2005, 09:11 AM
#4
Thread Starter
Lively Member
Re: Beginner needs a progress bar
Thats exactly what i want. Im not to bovered about the progress being in sync with the pinging. Its just to stop the inpatient users clicking away at buttons while it is performing its task. Is there no way of doing that in 2003 or will an upgrade to 2005 be the best plan of action?
-
Nov 14th, 2005, 10:06 AM
#5
Thread Starter
Lively Member
Re: Beginner needs a progress bar
I have added the progress bar and set the style as marque. How do i get it to start the progress bar when the "ping" button is pressed?
Thanks
Jason
-
Nov 14th, 2005, 04:18 PM
#6
Re: Beginner needs a progress bar
You would set the Style to Blocks in the designer and make sure the Value is zero, which it is by default. You would then set the Style to Marquee in code when you wanted the animation to start and then back to Blocks when you want it to end.
-
Nov 15th, 2005, 03:52 AM
#7
Thread Starter
Lively Member
Re: [RESOLVED] Beginner needs a progress bar
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
|