Link to home
Start Free TrialLog in
Avatar of fruitloopy
fruitloopy

asked on

VB.NET - Insert progress bar into loop

I've been asked to quickly run up a application that creates a text file of computers in an OU and then loops through each line to reboot them one by one.

I would really like to show a progress bar to give a visual indication but I've never done one of these before:

Here's my existing code:
Try
                    Dim str2 As String = File.OpenText(text).ReadLine
                    Dim reader2 As New StreamReader(text)
                    
                    Do While Not reader2.EndOfStream
                            str2 = reader2.ReadLine
                            Process.Start("C:\Windows\System32\shutdown.exe", " /m \\" & str2 & " /r /t 2 /d p:0:0")
                            Threading.Thread.Sleep(6000)
                            
                    Loop
                Catch ex As SystemException
                    MsgBox(ex.Message)
                End Try

Open in new window


Can anyone show me how to get "ProgressBar1" into this loop please?
ASKER CERTIFIED SOLUTION
Avatar of Randy Poole
Randy Poole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial