Total Pageviews

Labels

Seacrh By Labels

Contact Form

Name

Email *

Message *

Thursday, 25 October 2018

Cara Membuat Menu Login di Visual Studio 2010


1.Buat data base di Access


2. Buat From, Cara membuat from
3. Buat kodingan, texbox 1 ubah name txtuser dan texbox2 ubah name txtpasswd

4. Doubel klik pada texbox txtuser, masukan kodingan berikut:

Private Sub txtuser_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtuser.KeyPress

        If e.KeyChar = Chr(13) Then txtpasswd.Focus()

    End Sub

5.  Doubel klik pada texbox txtpasswd, masukan kodingan berikut:



Private Sub txtpasswd_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpasswd.KeyPress

        If e.KeyChar = Chr(13) Then cmdlogin.Focus()
   End Sub
6.Kodingan untuk button, kasih name button1 dengan cmdlogin sedangkan button2 cmdexit Kemudian double klik button Login:

Private Sub cmdlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdlogin.Click
        Dim username As String = txtuser.Text
        Dim password As String = txtpasswd.Text
        Dim sql As String = "select * from login where username='" & txtuser.Text & "' and passwd='" & txtpasswd.Text & "'"
        Dim Cmd As New OleDbCommand(sql, Conn)
        Dim RS_Login As OleDbDataReader = Cmd.ExecuteReader
        If RS_Login.HasRows Then
            MessageBox.Show("Login Sukses", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
            Me.Hide()
            menuutama.Show()
        Else
            MessageBox.Show("Login Gagal", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
        End If
    End Sub
7. Kemudian double klik button exit:

Private Sub cmdexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.Click
        Dim Pesan As String
        Pesan = MessageBox.Show("Wanna exit system?", "Conformation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
        If Pesan = vbOK Then Me.Close()
    End Sub
8.  Setelah itu coding buat from, double klik di from lalumasukan,

Public Class Formlogin

    Private Sub Formlogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call Buka_Koneksi()
    End Sub

9. Kemudulian buat modele

Kodingan Full menu login



0 komentar:

Post a Comment