“Form Login” dengan Visual Basic 6.0
Percontohan “Form Login” yang terdapat pada blog “Ketik Visual Basic!”.
Tidak ada modifikasi yang dibuat. Untuk lebih lengkapnya dapat dilihat pada kode sumber yang disertakan.
Kode Sumber “Form1”:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Log Masuk"
ClientHeight = 3975
ClientLeft = 45
ClientTop = 405
ClientWidth = 7140
BeginProperty Font
Name = "Segoe UI"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3975
ScaleWidth = 7140
StartUpPosition = 2 'CenterScreen
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 7
Top = 3600
Visible = 0 'False
Width = 7140
_ExtentX = 12594
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.CommandButton Command1
Caption = "K&eluar"
Height = 495
Index = 1
Left = 5160
TabIndex = 5
Top = 3360
Width = 1815
End
Begin VB.PictureBox Picture1
BackColor = &H00FFFFFF&
BorderStyle = 0 'None
Height = 3220
Left = 0
ScaleHeight = 3225
ScaleWidth = 7155
TabIndex = 6
Top = 0
Width = 7155
Begin VB.TextBox Text1
BeginProperty Font
Name = "Segoe UI"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Index = 0
Left = 2880
TabIndex = 1
Top = 765
Width = 2895
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "Segoe UI"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
IMEMode = 3 'DISABLE
Index = 1
Left = 2880
PasswordChar = "*"
TabIndex = 3
Top = 1440
Width = 2895
End
Begin VB.CommandButton Command1
Caption = "Log Masuk"
Height = 495
Index = 0
Left = 2880
TabIndex = 4
Top = 2160
Width = 2895
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Nama Pengguna:"
BeginProperty Font
Name = "Segoe UI"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Index = 0
Left = 840
TabIndex = 0
Top = 795
Width = 1785
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Kata Sandi:"
BeginProperty Font
Name = "Segoe UI"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Index = 1
Left = 1480
TabIndex = 2
Top = 1500
Width = 1140
End
End
Begin VB.Line Line1
Index = 0
X1 = 0
X2 = 7200
Y1 = 3240
Y2 = 3240
End
Begin VB.Line Line1
BorderColor = &H00FFFFFF&
BorderWidth = 4
Index = 1
X1 = 0
X2 = 6960
Y1 = 3240
Y2 = 3240
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i%
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0:
If Text1(Index).Text = "Administrator" And Text1(1).Text = "apakek" Then
Form2.Show
Me.Hide
Else
MsgBox "Nama Pengguna dan Kata Sandi Salah...!", vbCritical, "Kesalahan"
For i = 0 To 1
Text1(i).Text = Empty
Next
Text1(0).SetFocus
End If
Case 1:
End
End Select
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If (KeyAscii = 13) Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub
Kode Sumber “Form2”:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "MSCOMCTL.OCX"
Begin VB.Form Form2
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Caption = "Form2"
ClientHeight = 3975
ClientLeft = 45
ClientTop = 405
ClientWidth = 7140
BeginProperty Font
Name = "Segoe UI"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3975
ScaleWidth = 7140
StartUpPosition = 2 'CenterScreen
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 2
Top = 3600
Visible = 0 'False
Width = 7140
_ExtentX = 12594
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.CommandButton Command1
Caption = "Log Keluar"
Height = 495
Left = 5520
TabIndex = 1
Top = 120
Width = 1455
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "Segoe UI"
Size = 20.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 555
Left = 3420
TabIndex = 0
Top = 1200
Width = 135
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If MsgBox("Yakin untuk keluar ?", vbQuestion + _
vbYesNo, "Log Keluar") = vbYes Then
Form1.Show
Dim i%
For i = 0 To 1
Form1.Text1(i).Text = Empty
Next
Form1.Text1(0).SetFocus
Unload Me
End If
End Sub
Private Sub Form_Load()
Label1.Caption = "Selamat datang kembali" & vbCrLf _
& Chr(34) & Form1.Text1(0).Text & Chr(34)
End Sub
Unduh Kode Sumber
Label: VB6
0 Komentar:
Posting Komentar
Berlangganan Posting Komentar [Atom]
<< Beranda