Saturday, February 15, 2014

Windows Program Login & Signup Form

windows-login-form-codding-vbnet


Public Class Form1

    Dim cnt As Integer
    Public aa As Integer

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Me.Close()

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim namex, pass As String

        namex = TextBox1.Text
        pass = TextBox2.Text

        If namex <> "admi" Then
            TextBox1.BackColor = Color.Red
        End If

        If namex = "admi" And pass = "pass" Then
            aa = 1
            Form2.Show()
            Me.Hide()
        Else

            MsgBox("Username & Password incorrect! ")

            If cnt > 3 Then
                Me.Close()
                MsgBox("You are not longer connected with this Application!")
            End If
            cnt = cnt + 1

        End If

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        aa = 0
        Me.Hide()
        Form2.Show()
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox2.PasswordChar = "O"
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Me.Hide()
        Form3.Show()
    End Sub
End Class

 

windows-registration-form-codding-vbnet

Public Class Form3
    Dim cnt As Integer

    Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub TextBox1_LostFocus(sender As Object, e As EventArgs) Handles TextBox1.LostFocus
        Dim a As Integer

        a = Len(TextBox1.Text)

        If a < 6 Then
            Label7.Text = "Add more than 6 char"
            TextBox1.SelectAll()
        End If
    End Sub

    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

    End Sub

    Private Sub TextBox5_TextChanged(sender As Object, e As EventArgs) Handles TextBox5.TextChanged

    End Sub

    Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.LostFocus
        Dim first, sec As String

        first = TextBox3.Text
        sec = TextBox4.Text

        If first <> sec Then
            Label10.Text = "Password not Matched!"
            TextBox3.Focus()
        End If
    End Sub

    Private Sub TextBox3_TextChanged_1(sender As Object, e As EventArgs) Handles TextBox3.TextChanged

        If Len(TextBox3.Text) > 0 And Len(TextBox3.Text) <= 3 Then
            Label9.Text = "weak"
        ElseIf Len(TextBox3.Text) > 3 And Len(TextBox3.Text) <= 6 Then
            Label9.Text = "medium"
        ElseIf Len(TextBox3.Text) > 6 Then
            Label9.Text = "Strong"
        End If

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Me.Close()
        Form1.Show()

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Clear()
        TextBox2.Clear()
        TextBox3.Clear()
        TextBox4.Clear()
        TextBox5.Clear()
        TextBox6.Clear()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If cnt = 6 Then
            MsgBox("Register Completed!")
        End If
    End Sub
End Class

No comments:

Post a Comment