Progress Bar Issue

shyamsasi

New member
Joined
Nov 20, 2010
Messages
1
Programming Experience
Beginner
I'm creating my first application. I'm not very good at coding. If i make dump mistake please bare with me. :(

I can't get this Progress bar to work, I tried few steps. I'm writing this application to copying the Host file to a folder in desktop for troubleshooting purpose at Office. (there are few more if i can get this to work i can replicate the same for others)

This is the code

VB.NET:
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim USERPROFILE As String
        If ProgressBar1.Value < ProgressBar1.Maximum Then
            ProgressBar1.Value += 100
        Else
            ProgressBar1.Value = ProgressBar1.Minimum
        End If
        USERPROFILE = Environ("HOMEPATH")
        IO.Directory.CreateDirectory(USERPROFILE & "\Desktop\TechSupport")
        Dim oShell : oShell = CreateObject("WScript.shell")
        oShell.Run("CMD /C copy %windir%\system32\drivers\etc\HOSTS C:\hosts.txt", 0, True)
        My.Computer.FileSystem.CopyFile("C:\hosts.txt", USERPROFILE & "\Desktop\TechSupport\hosts.txt",
        Microsoft.VisualBasic.FileIO.UIOption.AllDialogs,
        Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing)
        My.Computer.FileSystem.DeleteFile("C:\hosts.txt")
        MsgBox("Thank You for your Patience.")
        
    End Sub

    Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click

    End Sub

What modification i have to make to get the Progress bar correctly.

Thanks in advance
Shyam
 
Back
Top