Listing program client:
Form login
Private Sub Form_Load()
Call Hapus
End Sub
Sub Hapus()
User.Text = ""
Pass.Text = ""
End Sub
Private Sub keluar_Click()
Unload Me
End Sub
Private Sub login_Click()
If User.Text = "sriwahyuni" And Pass.Text = "sriwahyuni" Then
menu.Show
ElseIf User.Text = "siti" And Pass.Text = "siti" Then
menu.Show
ElseIf User.Text = "desi" And Pass.Text = "desi" Then
menu.Show
ElseIf User.Text = "leni" And Pass.Text = "leni" Then
menu.Show
ElseIf User.Text = "rahma" And Pass.Text = "rahma" Then
menu.Show
ElseIf User.Text = "ulan" And Pass.Text = "ulan" Then
menu.Show
ElseIf User.Text = "wewen" And Pass.Text = "wewen" Then
menu.Show
Unload Me
Else
MsgBox "Password Anda Salah!!!", vbInformation, "info"
Call Hapus
User.SetFocus
End If
End Sub
Private Sub pass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If User.Text = "sriwahyuni" And Pass.Text = "sriwahyuni" Then
menu.Show
Unload Me
Else
MsgBox "Password Anda Salah!!!"
Call Hapus
User.SetFocus
End If
End If
End Sub
Private Sub user_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If User.Text = "" Then
MsgBox "Username belum diisi!!!"
Else
Pass.SetFocus
End If
End If
End Sub
Menu utama
Private Sub f2_Click()
frm_Mahasiswa.Show
End Sub
Private Sub f3_Click()
End
End Sub
Form Mahasiswa
Sub Hapus()
Npm.Enabled = True
ClearFORM Me
Call RubahCMD(Me, True, False, False, False)
cmdproses(1).Caption = "&simpan"
End Sub
Private Sub cmdproses_Click(Index As Integer)
End
End Sub
Private Sub Form_Load()
Call Hapus
Jurusan.AddItem "MANAJEMEN"
Jurusan.AddItem "TEKNIK"
Jurusan.AddItem "INFORMASI"
Jenjang.AddItem "S1"
Jenjang.AddItem "D3"
Jenjang.AddItem "D1"
MulaiKoneksi
End Sub
Private Sub Npm_keyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Npm.Text = "" Then Exit Sub
WS.SendData "SEARCH-" & Npm.Text
End If
End Sub
Sub MulaiKoneksi()
IPServer = "192.168.10.1"
IPClient = WS.LocalIP
WS.Connect IPServer, 1500
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
DoEvents
End
End Sub
Private Sub WS_DataArrival(ByVal bytesTotal As Long)
Dim xKirim As String
Dim xData1() As String
Dim xData2() As String
WS.GetData xKirim, vbString, bytesTotal
xData1 = Split(xKirim, "-")
Select Case xData1(0)
Case "NOTHING"
x = Npm.Text
Call Hapus
Npm.Text = ""
Call RubahCMD(Me, False, True, False, True)
cmdproses(1).Caption = "&Simpan"
Jurusan.SetFocus
Case "RECORD"
xData2 = Split(xData1(1), "/")
Jurusan.Text = xData2(0)
Jenjang.Text = xData2(1)
Call RubahCMD(Me, False, True, True, True)
cmdproses(1).Caption = "&Edit"
Npm.Enabled = False
Nama.SetFocus
Case "DEL"
MsgBox "Penghapusan Data Berhasil !!!"
Call Hapus
Case "EDIT"
MsgBox "Pengeditan Record Berhasil !!!"
Call Hapus
Case "INSERT"
MsgBox "Penginsertan Berhasil !!!!"
Call Hapus
End Select
End Sub
Module
Public SQL As String
Sub ClearFORM(f As Form)
Dim ctl As Control
For Each ctl In f
If TypeOf ctl Is TextBox Then ctl.Text = ""
If TypeOf ctl Is ComboBox Then ctl.Text = ""
Next
End Sub
Sub Center(f As Form)
f.Move (Screen.Width - f.Width) / 2, (Screen.Height - f.Height) / 4
End Sub
Sub RubahCMD(f As Form, L0 As Boolean, L1 As Boolean, L2 As Boolean, L3 As Boolean)
f.cmdproses(0).Enabled = L0
f.cmdproses(1).Enabled = L1
f.cmdproses(2).Enabled = L2
f.cmdproses(3).Enabled = L3
End Sub
Tidak ada komentar:
Posting Komentar