Rabu, 16 Desember 2015

Contoh Coding Login Menggunakan Vb.Net 2010


Public Class LOGIN

    Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

    End Sub

    Private Sub btnmasuk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmasuk.Click
        If txtuser.Text = "labvb" And txtpswd.Text = "visualbasic" Then
            MessageBox.Show("Login Berhasil")
            menu_utama.Show()
            Me.Hide()

        ElseIf txtuser.Text = "labvb" Then
            If txtpswd.Text = "" Then
                MessageBox.Show("Password Tidak Boleh Kosong")

            Else
                MessageBox.Show("Password Anda Salah")
                txtuser.Text = ""
                txtpswd.Focus()

            End If

        ElseIf txtpswd.Text = "visualbasic" Then
            If txtuser.Text = "" Then
                MessageBox.Show("Username Tidak Boleh Kosong")

            Else
                MessageBox.Show("Username Anda Salah")
                txtpswd.Text = ""
                txtuser.Focus()

            End If

        Else
            If txtuser.Text = "" And txtpswd.Text = "" Then
                MessageBox.Show("Username dan Password Tidak Boleh Kosong")

            Else
                MessageBox.Show("Username dan Password Anda Salah")
                txtuser.Text = ""
                txtpswd.Text = ""
                txtuser.Focus()

            End If

        End If
    End Sub


    Private Sub btnbatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbatal.Click
        Me.Close()

    End Sub
End Class

Tidak ada komentar:

Posting Komentar