twitter dan facebook

daftar isi

Labels

Recent Post

My Ping in TotalPing.com
Free Music Online
Free Music Online

free music at divine-music.info

Senin, 15 April 2013

Belajar Membuat Login dan Form pada Visual Basic 6.0


ToolBox
Properties
Label
Name [Label1/Nama]
     [Label2/Password]
TextBox
Name [Text1][Text2]
Text [hapus]
CommandButton
Name [Command1/Masuk]
     [Command2/Batal]


Code :
Private Sub Command1_Click()
On Error Resume Next
If Text1.Text <> "" And Text2.Text = "hamdan" Or Text1.Text <> "" And Text2.Text = "hangly" Then
Me.Hide
MDIForm1.Show
Else
MsgBox "Password Salah..!", vbInformation, "Perhatian"
Text2.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
_____________________________________________________________________
Private Sub Command2_Click()
End
End Sub
_____________________________________________________________________
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
_____________________________________________________________________
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub







ToolBox
Properties
Label
Name [Label1/KodeSupplier]
     [Label2/Nama]
     [Label3/Alamat]
     [Label4/Telpon]
TextBox
Name [Text1][Text2]
     [Text3][Text4]
Text [hapus]
CommandButton
Name [Command1/Tambah]
     [Command2/Simpan Data]
     [Command3/Batal]
[Command4/Ok]
[Command5/Cari dan Lihat Tabel]
[Command6/Lihat Laporan]
Code :
Private Sub Command1_Click()


Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text1.BackColor = &H80000005
Text2.BackColor = &H80000005
Text3.BackColor = &H80000005
Text4.BackColor = &H80000005
Text1.SetFocus
End Sub


_____________________________________________________________________
Private Sub Command2_Click()


With Form2.Adodc1.Recordset
    .AddNew
    !KdSupplier = Text1.Text
    !Nama = Text2.Text
    !Alamat = Text3.Text
    !Telp = Text4.Text
    .Update
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
End With
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
Command4.Enabled = True
Text1.SetFocus
TEXT_TIDAK_AKTIF
Text1.BackColor = &H8000000F
Text2.BackColor = &H8000000F
Text3.BackColor = &H8000000F
Text4.BackColor = &H8000000F
End Sub



_____________________________________________________________________
Private Sub Command3_Click()


    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
End Sub


_____________________________________________________________________
Private Sub Command4_Click()
Me.Hide
MDIForm1.Show
End Sub
_____________________________________________________________________
Private Sub Command5_Click()
Me.Hide
Form2.Show
End Sub
_____________________________________________________________________
Private Sub Command6_Click()
With DataReport1
.WindowState = vbMaximixed
.Show
End With
End Sub
_____________________________________________________________________
Private Sub Form_Load()


koneksi

Adodc.ConnectionString = Conn.ConnectionString
Adodc.RecordSource = "select * from Supplier"
Adodc.Refresh
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
TEXT_TIDAK_AKTIF
Me.Width = 9540
Me.Height = 5940
Me.Top = 2000
Me.Left = 2000
End Sub
Sub TEXT_TIDAK_AKTIF()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
End Sub
Sub TEXT_AKTIF()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
End Sub


_____________________________________________________________________
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
_____________________________________________________________________
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
_____________________________________________________________________
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
_____________________________________________________________________
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command2.SetFocus
End If
End Sub


Terimakasih telah mampir ke blog kami Lihat juga disini

0 comments

Poskan Komentar