Page 1 of 1

Login Form + Progress Bar

Posted: Tue Jun 14, 2011 2:57 pm
by patsquare
Last time I was looking at a topic on making a web browser and i saw a code on progress bar and i wanted to try and make a small program to work some progress bars.

Ok so this is my first post and first program i tried to make.


First the user needs to pass the login form

Then his program increases progress bar 1 by 25 when its full at 100 it goes back to 0 and increases progress bar 2 by 10 when progress bar 2 is full it decreses progress bar 3 by 5 (-5)

When progress bar 3 has a value of 0 a message box appears if user presses yes it takes him to a website and if he presses no it just closes

Now to make the program:

You will need
3 progress bars
3 labels
1 button

And add this code:
Code: Select all
Public Class Form1
    Dim userchoice As Integer
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar2.Enabled = False
        ProgressBar3.Enabled = False
        Button1.Enabled = False
        ProgressBar1.Increment(25)
        If ProgressBar1.Value = 100 Then
            ProgressBar1.Value = 0
            ProgressBar1.Enabled = False
            ProgressBar2.Enabled = True
            ProgressBar2.Value = ProgressBar2.Value + 10
            If ProgressBar2.Value = 100 Then
                ProgressBar2.Enabled = False
                ProgressBar3.Enabled = True
                ProgressBar2.Value = 0
                ProgressBar3.Value = ProgressBar3.Value - 5
            End If
        End If
        Label1.Text = ProgressBar1.Value
        Label2.Text = ProgressBar2.Value
        Label3.Text = ProgressBar3.Value
        If ProgressBar3.Value = 0 Then
            Timer1.Enabled = False
            userchoice = MsgBox("Process Done. Do you want to go to website?", MsgBoxStyle.YesNo, "Do you want to go")
            If userchoice = vbYes Then
                System.Diagnostics.Process.Start("www.google.com")
                Button1.Enabled = True
            ElseIf userchoice = vbNo Then
                End
            End If
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()
    End Sub
End Class
Now For The login Form

Go to project/add windows form
and look for login form double click on the ok button and add this code
Code: Select all
If UsernameTextBox.Text = "123" And PasswordTextBox.Text = "123" Then Form1.Show() Else MsgBox("Wrong Password", MsgBoxStyle.Critical, "Wrong Password")

        If UsernameTextBox.Text = "123" And PasswordTextBox.Text = "123" Then Me.Close()
Then go to options and
chose startup form : Loginform1
shutdown mode : When Last Form Closes

and then click on progress bar 3 and set its value to 100

check out my timer :D
viewtopic.php?f=38&t=6188

Re: Login Form + Progress Bar

Posted: Tue Jun 14, 2011 5:59 pm
by Bogoh67
wait a login frm to use the internet?

Re: Login Form + Progress Bar

Posted: Tue Jun 14, 2011 6:09 pm
by Agust1337
Bogoh67 wrote:
wait a login frm to use the internet?
No it doesn't, a messagebox will show up if you want to open google.com or not

Re: Login Form + Progress Bar

Posted: Tue Jun 14, 2011 6:44 pm
by patsquare
This was just a little experiment i tried to do with progress bars and message boxes you can make it do anything after the user presses yes/no