📄 frmmember.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form FrmMember
BackColor = &H00EFF2EC&
BorderStyle = 1 'Fixed Single
Caption = "Pendaftaran Member"
ClientHeight = 6705
ClientLeft = 45
ClientTop = 390
ClientWidth = 5160
Icon = "FrmMember.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6705
ScaleWidth = 5160
StartUpPosition = 2 'CenterScreen
Begin VB.TextBox TxtUser
Height = 375
Left = 1680
TabIndex = 1
Top = 600
Width = 3015
End
Begin VB.TextBox TxtDeposit
Height = 375
Left = 1680
TabIndex = 6
Top = 3000
Width = 3015
End
Begin VB.TextBox TxtTelpon
Height = 375
Left = 1680
TabIndex = 5
Top = 2520
Width = 3015
End
Begin VB.TextBox TxtAlamat
Height = 375
Left = 1680
TabIndex = 4
Top = 2040
Width = 3015
End
Begin VB.TextBox TxtNama
Height = 375
Left = 1680
TabIndex = 3
Top = 1560
Width = 3015
End
Begin VB.TextBox TxtPassword
Height = 375
Left = 1680
TabIndex = 2
Top = 1080
Width = 3015
End
Begin VB.CommandButton CmdSimpan
Caption = "Simpan"
Height = 495
Left = 480
TabIndex = 7
Top = 3720
Width = 975
End
Begin VB.CommandButton CmdTutup
Caption = "Tutup"
Height = 495
Left = 3720
TabIndex = 10
Top = 3720
Width = 975
End
Begin VB.CommandButton CmdHapus
Caption = "Hapus"
Height = 495
Left = 2640
TabIndex = 9
Top = 3720
Width = 975
End
Begin VB.CommandButton CmdUbah
Caption = "Edit"
Height = 495
Left = 1560
TabIndex = 8
Top = 3720
Width = 975
End
Begin VB.Frame Frame1
Caption = "Pendaftaran Member"
Height = 6375
Left = 120
TabIndex = 0
Top = 120
Width = 4935
Begin MSFlexGridLib.MSFlexGrid GridMember
Height = 2055
Left = 120
TabIndex = 17
Top = 4200
Width = 4695
_ExtentX = 8281
_ExtentY = 3625
_Version = 393216
Cols = 3
FixedCols = 0
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "Deposit"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00B54524&
Height = 255
Left = 240
TabIndex = 16
Top = 2880
Width = 1095
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "No. Telpon"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00B54524&
Height = 255
Left = 240
TabIndex = 15
Top = 2400
Width = 1455
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "Alamat"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00B54524&
Height = 255
Left = 240
TabIndex = 14
Top = 1920
Width = 1455
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "Nama Asli"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00B54524&
Height = 255
Left = 240
TabIndex = 13
Top = 1440
Width = 1455
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "Password"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00B54524&
Height = 255
Left = 240
TabIndex = 12
Top = 960
Width = 1455
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "Nama User"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00B54524&
Height = 255
Left = 240
TabIndex = 11
Top = 480
Width = 1455
End
End
End
Attribute VB_Name = "FrmMember"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdhapus_Click()
On Error Resume Next
cn.Open
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
cmd.CommandText = "SELECT member.* FROM member WHERE member.user = '" & TxtUser.Text & "'"
cmd.Execute
rs.ActiveConnection = cn
rs.Open "SELECT member.* FROM member WHERE member.user = '" & TxtUser.Text & "'", cn, adOpenStatic, adLockOptimistic
If Not rs.RecordCount = 0 Then
rs.Delete
End If
cn.Close
Bersih
CmdSimpan.Enabled = False
CmdUbah.Enabled = False
CmdHapus.Enabled = False
TxtUser.Text = ""
TxtUser.SetFocus
End Sub
Private Sub cmdsimpan_Click()
On Error Resume Next
Dim passwd As String
passwd = EncryptText(TxtPassword.Text, "password")
cn.Open
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
cmd.CommandText = "SELECT member.* FROM member WHERE member.user = '" & TxtUser.Text & "'"
cmd.Execute
rs.ActiveConnection = cn
rs.Open "SELECT member.* FROM member WHERE member.user = '" & TxtUser.Text & "'", cn, adOpenStatic, adLockOptimistic
If Not rs.RecordCount = 0 Then
rs(0) = TxtUser.Text
rs(4) = passwd
rs(1) = TxtNama.Text
rs(2) = TxtAlamat.Text
rs(3) = TxtTelpon.Text
rs(5) = Val(TxtDeposit.Text)
rs.Update
MsgBox "Restart server untuk hasil yang optimal", vbOKOnly, "Rekomendasi"
Else
rs.AddNew
rs(0) = TxtUser.Text
rs(4) = passwd
rs(1) = TxtNama.Text
rs(2) = TxtAlamat.Text
rs(3) = TxtTelpon.Text
rs(5) = Val(TxtDeposit.Text)
rs.Update
MsgBox "Restart server untuk hasil yang optimal", vbOKOnly, "Rekomendasi"
End If
cn.Close
Bersih
CmdSimpan.Enabled = False
CmdUbah.Enabled = False
CmdHapus.Enabled = False
TxtUser.Text = ""
TxtUser.SetFocus
End Sub
Private Sub loadgrid()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim sql As String
GridMember.TextMatrix(0, 0) = "User Name"
GridMember.TextMatrix(0, 1) = "Nama Asli"
GridMember.TextMatrix(0, 2) = "Sisa Deposit"
GridMember.ColWidth(0) = 1100
GridMember.ColWidth(1) = 1600
GridMember.ColWidth(2) = 1950
sql = "SELECT member.* FROM member"
cn.Open con1
rs.ActiveConnection = cn
rs.Open sql, cn, adOpenStatic, adLockOptimistic
If Not rs.RecordCount = 0 Then
GridMember.Rows = rs.RecordCount + 1
rs.MoveFirst
For i = 1 To rs.RecordCount
GridMember.TextMatrix(i, 0) = rs(0)
GridMember.TextMatrix(i, 1) = rs(1)
GridMember.TextMatrix(i, 2) = Format(rs(5), "##,##0.00")
rs.MoveNext
Next i
Else
GridMember.Rows = 1
End If
cn.Close
End Sub
Private Sub CmdTutup_Click()
Unload Me
End Sub
Private Sub CmdUbah_Click()
CmdUbah.Enabled = False
CmdHapus.Enabled = False
CmdSimpan.Enabled = True
TxtPassword.SetFocus
End Sub
Private Sub Form_Load()
Call loadgrid
End Sub
Private Sub TxtAlamat_GotFocus()
TxtAlamat.Backcolor = &HFFFF00
End Sub
Private Sub TxtAlamat_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtTelpon.SetFocus
End If
End Sub
Private Sub TxtAlamat_LostFocus()
TxtAlamat.Backcolor = &HFFFFFF
End Sub
Private Sub TxtDeposit_GotFocus()
TxtDeposit.Backcolor = &HFFFF00
End Sub
Private Sub TxtDeposit_LostFocus()
TxtDeposit.Backcolor = &HFFFFFF
End Sub
Private Sub TxtNama_GotFocus()
TxtNama.Backcolor = &HFFFF00
End Sub
Private Sub TxtNama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtAlamat.SetFocus
End If
End Sub
Private Sub TxtNama_LostFocus()
TxtNama.Backcolor = &HFFFFFF
End Sub
Private Sub TxtPassword_GotFocus()
TxtPassword.Backcolor = &HFFFF00
End Sub
Private Sub TxtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtNama.SetFocus
End If
End Sub
Private Sub TxtPassword_LostFocus()
TxtPassword.Backcolor = &HFFFFFF
End Sub
Private Sub TxtTelpon_GotFocus()
TxtTelpon.Backcolor = &HFFFF00
End Sub
Private Sub TxtTelpon_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtDeposit.SetFocus
End If
End Sub
Private Sub TxtTelpon_LostFocus()
TxtTelpon.Backcolor = &HFFFFFF
End Sub
Private Sub TxtUser_GotFocus()
TxtUser.Backcolor = &HFFFF00
End Sub
Private Sub TxtUser_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Not TxtUser.Text = "" Then
CekUser
End If
End If
End Sub
Private Sub TxtUser_LostFocus()
TxtUser.Backcolor = &HFFFFFF
End Sub
Private Sub CekUser()
On Error Resume Next
cn.Open
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
cmd.CommandText = "SELECT member.* FROM member WHERE member.user = '" & TxtUser.Text & "'"
cmd.Execute
rs.ActiveConnection = cn
rs.Open "SELECT member.* FROM member WHERE member.user = '" & TxtUser.Text & "'", cn, adOpenStatic, adLockOptimistic
If rs.RecordCount = 0 Then
Baru
Else
TxtPassword.Text = DecryptText(rs(4), "password")
TxtNama.Text = rs(1)
TxtAlamat.Text = rs(2)
TxtTelpon.Text = rs(3)
TxtDeposit = rs(5)
CmdUbah.Enabled = True
CmdHapus.Enabled = True
CmdSimpan.Enabled = False
End If
cn.Close
End Sub
Private Sub Bersih()
TxtPassword.Text = ""
TxtNama.Text = ""
TxtAlamat.Text = ""
TxtTelpon.Text = ""
TxtDeposit.Text = ""
End Sub
Private Sub Baru()
Bersih
TxtPassword.SetFocus
CmdSimpan.Enabled = True
CmdUbah.Enabled = False
CmdHapus.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -