Tuesday, February 22, 2011

Login Form (Vb.Net desktop)

This case I want to make login control in vb.net. There is the code that maybe usefull to make log in system in Vb.Net






note:
  • button1 as login button
  • button2 as keluar button



Public Class Formlogin

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Classdatabase.bukadatabase()
Classdatabase.perintahsql.CommandText = CommandType.Text
Classdatabase.perintahsql.CommandText = "select * from admin where username='" & TextBox1.Text & "' and password='" & TextBox2.Text & "'"
Classdatabase.ketemu = Classdatabase.perintahsql.ExecuteReader

If Classdatabase.ketemu.Read Then
Me.Hide()
Menuutama.Show()
Else
MsgBox("Nama dan Kata Sandi Tidak Ditemukan", 48, "Perhatian")

End If

Classdatabase.tutupdatabase()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim tanya As String
tanya = MsgBox("Apakah anda ingin keluar Aplikasi EWS?", MsgBoxStyle.YesNo, "Question")
If tanya = vbYes Then
Me.Hide()
MsgBox("Thanks For using our application" & Chr(13) & "Contact us For update the version", MsgBoxStyle.Information, "info")
Close()
Else
MsgBox("Silahkan Lanjutkan pemakaian Aplikasi", MsgBoxStyle.Information, "Information")
End If
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label6.Text = Format(Now, "hh:mm:ss")
End Sub


Example of vb.net exercise

Note: change data connection in class with your correct resource

No comments:

Post a Comment

web programming