?? system1.frm
字號:
VERSION 5.00
Begin VB.Form frmadduser
Caption = "增加用戶"
ClientHeight = 4560
ClientLeft = 60
ClientTop = 450
ClientWidth = 6540
LinkTopic = "Form1"
ScaleHeight = 4560
ScaleWidth = 6540
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 495
Left = 3000
TabIndex = 9
Text = "Text3"
Top = 2040
Width = 2055
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3360
TabIndex = 8
Top = 3720
Width = 2055
End
Begin VB.CommandButton Command1
Caption = "確定"
Height = 495
Left = 600
TabIndex = 7
Top = 3720
Width = 1575
End
Begin VB.TextBox Text2
Height = 375
Left = 2880
TabIndex = 6
Text = "Text2"
Top = 1320
Width = 2415
End
Begin VB.TextBox Text1
Height = 375
Left = 3000
TabIndex = 5
Text = "Text1"
Top = 480
Width = 2295
End
Begin VB.ComboBox Combo1
Height = 300
Left = 3000
TabIndex = 3
Text = "Combo1"
Top = 2760
Width = 2175
End
Begin VB.Label Label4
Caption = "選擇權(quán)限"
Height = 375
Left = 240
TabIndex = 4
Top = 2760
Width = 1695
End
Begin VB.Label Label3
Caption = "確認(rèn)密碼"
Height = 495
Left = 240
TabIndex = 2
Top = 1920
Width = 2175
End
Begin VB.Label Label2
Caption = "輸入密碼"
Height = 495
Left = 240
TabIndex = 1
Top = 1080
Width = 2175
End
Begin VB.Label Label1
Caption = "輸入用戶名"
Height = 375
Left = 240
TabIndex = 0
Top = 360
Width = 2175
End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim rs_add As New ADODB.Recordset
If Trim(Text1.Text) = "" Then
MsgBox "用戶名不能為空", vbOKOnly + vbExclamation, ""
Exit Sub
Text1.SetFocus
Else
sql = "select * from 系統(tǒng)管理"
rs_add.Open sql, conn, adOpenKeyset, adLockPessimistic
While (rs_add.EOF = False)
If Trim(rs_add.Fields(0)) = Trim(Text1.Text) Then
MsgBox "已有這個(gè)用戶", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Combo1.Text = ""
Exit Sub
Else
rs_add.MoveNext
End If
Wend
If Trim(Text2.Text) <> Trim(Text3.Text) Then
MsgBox "兩次密碼不一致", vbOKOnly + vbExclamation, ""
Text2.SetFocus
Text2.Text = ""
Text3.Text = ""
Exit Sub
ElseIf Trim(Combo1.Text) <> "system" And Trim(Combo1.Text) <> "guest" Then
MsgBox "請選擇正確的用戶權(quán)限", vbOKOnly + vbExclamation, ""
Combo1.SetFocus
Combo1.Text = ""
Exit Sub
Else
rs_add.AddNew
rs_add.Fields(0) = Text1.Text
rs_add.Fields(1) = Text2.Text
rs_add.Fields(2) = Combo1.Text
rs_add.Update
rs_add.Close
MsgBox "添加用戶成功", vbOKOnly + vbExclamation, ""
Unload Me
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Combo1.AddItem "system"
Combo1.AddItem "guest"
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -