?? frm_systemer.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_systemer
BorderStyle = 3 'Fixed Dialog
Caption = "用戶管理"
ClientHeight = 2205
ClientLeft = 3645
ClientTop = 2925
ClientWidth = 4920
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2205
ScaleWidth = 4920
ShowInTaskbar = 0 'False
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 720
Top = 3480
Width = 2415
_ExtentX = 4260
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox Text5
Height = 375
Left = 840
TabIndex = 14
Text = "1"
Top = 2880
Width = 1455
End
Begin VB.Frame Frame3
Caption = "操作選擇"
Height = 700
Left = 60
TabIndex = 9
Top = 60
Width = 4815
Begin VB.OptionButton Option1
Caption = "注冊新用戶"
Height = 375
Left = 840
TabIndex = 11
Top = 240
Width = 1455
End
Begin VB.OptionButton Option2
Caption = "刪除現有的用戶"
Height = 375
Left = 2640
TabIndex = 10
Top = 240
Width = 1815
End
End
Begin VB.CommandButton Command3
Caption = "取消"
Height = 350
Left = 3900
TabIndex = 8
Top = 1850
Width = 975
End
Begin VB.CommandButton Command1
Caption = "確定"
Height = 350
Left = 2900
TabIndex = 6
Top = 1850
Width = 975
End
Begin VB.CommandButton Command2
Caption = "確定"
Height = 350
Left = 2900
TabIndex = 7
Top = 1850
Width = 975
End
Begin VB.Frame Frame2
Height = 1000
Left = 60
TabIndex = 1
Top = 800
Width = 4815
Begin VB.TextBox Text4
Height = 300
IMEMode = 3 'DISABLE
Left = 3240
PasswordChar = "*"
TabIndex = 18
Top = 600
Width = 1455
End
Begin VB.TextBox Text3
Height = 300
IMEMode = 3 'DISABLE
Left = 960
PasswordChar = "*"
TabIndex = 17
Top = 600
Width = 1335
End
Begin VB.TextBox Text2
Height = 300
Left = 3240
TabIndex = 16
Top = 240
Width = 1455
End
Begin VB.TextBox Text1
Height = 300
Left = 960
TabIndex = 15
Top = 240
Width = 1335
End
Begin VB.Label Label5
Caption = "職務"
Height = 255
Left = 2400
TabIndex = 13
Top = 320
Width = 615
End
Begin VB.Label Label3
Caption = "確認密碼"
Height = 225
Left = 2400
TabIndex = 4
Top = 720
Width = 855
End
Begin VB.Label Label2
Caption = "用戶密碼"
Height = 200
Left = 120
TabIndex = 3
Top = 720
Width = 855
End
Begin VB.Label Label1
Caption = "用戶名稱"
Height = 255
Left = 120
TabIndex = 2
Top = 320
Width = 855
End
End
Begin VB.Frame Frame1
Height = 1000
Left = 60
TabIndex = 0
Top = 800
Width = 4815
Begin VB.ComboBox Combo1
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 12
Top = 530
Width = 2325
End
Begin VB.Label Label4
Caption = "請選擇您要刪除的用戶名稱"
Height = 255
Left = 1360
TabIndex = 5
Top = 240
Width = 2175
End
End
End
Attribute VB_Name = "frm_systemer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Command2_Click
Else
End If
End Sub
'*** 用戶注冊信息的事件代碼 ***
Private Sub Command1_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '運用API函數SetWindowPos,來實現取消窗體置前的功能
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "輸入的用戶注冊信息不完全!!", , "提示信息"
Else
Adodc1.RecordSource = "select * from tb_enter where M_Name='" + Text1 + "'" '判斷注冊的用戶名是否存在
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "該用戶名已經存在,請您更換其他用戶名!", 48, "提示信息"
Text1.Text = "" '如果該用戶名存在則重新輸入
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text1.SetFocus
Else
If Text3.Text = Text4.Text Then '判斷兩次輸入的密碼是否一致
Adodc1.RecordSource = "select * from tb_enter order by M_ID"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text5.Text = Val(Adodc1.Recordset.Fields("M_ID")) + 1
Else
Text5.Text = 1
End If
Call main
'保存注冊信息
Set adoRs = adoCon.Execute("insert into tb_enter values(" & Text5 & ",'" & Text1 & "','" & Text2 & "','" & Text3 & "','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')")
MsgBox "注冊成功!!", 48, "用戶注冊信息提示"
adoCon.Close
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Unload Me
Else
MsgBox "兩次輸入的密碼不一致,請您確認后重新輸入", 48, "用戶注冊信息提示"
Text3.Text = ""
Text4.Text = ""
Text3.SetFocus
End If
End If
End If
End Sub
'*** 刪除用戶信息的事件代碼 ***
Private Sub Command2_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '運用API函數SetWindowPos,來實現取消窗體置前的功能
If Combo1.Text = Name1 Then '如果是當前登錄的用戶名,則不允許刪除
MsgBox "不能刪除當前用戶名!!", 48, "提示信息"
Else
a = MsgBox("您確認要刪除該用戶嗎?", 17, "刪除用戶信息提示")
If a = vbOK Then
Adodc1.RecordSource = "select * from tb_enter where M_Name='" + Combo1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete '如果數據庫中存在該用戶信息,則將其刪除
MsgBox "用戶信息刪除成功", 64, "刪除用戶信息提示"
Unload Me
Else
MsgBox "當前數據庫中沒有可刪除的用戶信息", , "信息提示"
End If
End If
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
If Option1.Value = 1 Then
Frame2.Visible = True
Frame1.Visible = False
Command1.Visible = True
Command2.Visible = False
ElseIf Option2.Value = 1 Then
Frame1.Visible = True
Frame2.Visible = False
Command2.Visible = True
Command1.Visible = False
Else
End If
End Sub
Private Sub Form_Load()
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) '運用API函數SetWindowPos,來實現使窗體置前的功能
'利用代碼連接數據庫
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_kcgl.mdb;Persist Security Info=False"
Option1.Value = True
Adodc1.RecordSource = "select * from tb_enter order by M_ID"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Do While Adodc1.Recordset.EOF = False '將操作員信息添加到Combo1控件當中
Combo1.AddItem (Adodc1.Recordset.Fields("M_Name"))
Adodc1.Recordset.MoveNext
Loop
End If
End Sub
Private Sub Option1_Click()
Frame2.Visible = True
Frame1.Visible = False
Command1.Visible = True
Command2.Visible = False
End Sub
Private Sub Option2_Click()
Frame1.Visible = True
Frame2.Visible = False
Command2.Visible = True
Command1.Visible = False
Combo1.SetFocus
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text2.SetFocus
Else
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '如果按下的是回車鍵,則光標落到文本框當中
Text3.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '如果按下的是回車鍵,則光標落到文本框當中
Text4.SetFocus
Else
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Command1_Click
Else
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -