?? frmnewuser.frm
字號(hào):
VERSION 5.00
Begin VB.Form frmNewUser
BackColor = &H80000016&
Caption = "新用戶注冊(cè)"
ClientHeight = 3135
ClientLeft = 60
ClientTop = 450
ClientWidth = 5850
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = -1 'True
EndProperty
LinkTopic = "Form2"
ScaleHeight = 3135
ScaleWidth = 5850
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox txtNewPass2
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1440
TabIndex = 7
Top = 1800
Width = 1575
End
Begin VB.TextBox txtNewPass1
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1440
TabIndex = 6
Top = 1320
Width = 1575
End
Begin VB.TextBox txtUserName
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1440
TabIndex = 5
Top = 840
Width = 1575
End
Begin VB.Line Line2
X1 = 4320
X2 = 5880
Y1 = 2640
Y2 = 2640
End
Begin VB.Label Exit
BackColor = &H80000010&
Caption = "取消"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5160
TabIndex = 11
Top = 2760
Width = 495
End
Begin VB.Label cmdOK
BackColor = &H80000010&
Caption = "確定"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4440
TabIndex = 10
Top = 2760
Width = 495
End
Begin VB.Label Label7
Caption = "(長(zhǎng)度小于15個(gè)字符)"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3360
TabIndex = 9
Top = 1320
Width = 1815
End
Begin VB.Label Label6
Caption = "(長(zhǎng)度小于10個(gè)字符)"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3360
TabIndex = 8
Top = 840
Width = 1815
End
Begin VB.Label Label5
Caption = "確認(rèn)密碼:"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 4
Top = 1800
Width = 975
End
Begin VB.Label Label4
Caption = "密 碼:"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 3
Top = 1320
Width = 975
End
Begin VB.Label Label3
Caption = "用 戶 名:"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 2
Top = 840
Width = 975
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "用戶注冊(cè)"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3360
TabIndex = 1
Top = 360
Width = 735
End
Begin VB.Line Line1
X1 = 720
X2 = 4440
Y1 = 600
Y2 = 600
End
Begin VB.Label Label1
Caption = "學(xué)籍管理系統(tǒng)"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 840
TabIndex = 0
Top = 240
Width = 2055
End
End
Attribute VB_Name = "frmNewUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private conn As ADODB.Connection
Private rs As ADODB.Recordset
Private Sub cmdOK_Click() '確定
If LTrim$(RTrim$(txtUserName.Text)) <> "" Then
If Trim(txtNewPass1.Text) <> "" Then
If txtNewPass1.Text <> txtNewPass2.Text Then
MsgBox "密碼不一致,請(qǐng)重新輸入!", vbInformation + vbOKOnly, "提示"
txtNewPass1.Text = "": txtNewPass2.Text = "": txtNewPass1.SetFocus
Else
InputUser '將新記錄添加到數(shù)據(jù)庫(kù)
End If
Else
MsgBox "密碼不能為空,請(qǐng)重新輸入!"
txtNewPass1.Text = ""
txtNewPass1.SetFocus
End If
Else
MsgBox "用戶名不能為空!", vbQuestion + vbOKOnly, "提示"
txtUserName.SetFocus
End If
End Sub
Private Sub cmdOk_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdOK.BorderStyle = 1
End Sub
Private Sub cmdOk_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdOK.BorderStyle = 0
End Sub
Sub InputUser() '添加用戶模塊
Dim txtsql As String
txtsql = "select * from xsADI where userName='" & Trim(txtUserName.Text) & "'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open txtsql, conn, 2, 2
If rs.EOF = False Then '查找數(shù)據(jù)庫(kù)是否存在該記錄
i = MsgBox("用戶名已經(jīng)存在!是否重新輸入?", vbYesNo + vbExclamation, "警告")
If i = vbYes Then
txtUserName = ""
txtUserName.SetFocus
txtNewPass1.Text = ""
txtNewPass2.Text = ""
Else
Me.Hide
Exit Sub
End If
Else
rs.AddNew '添加新記錄
rs.Fields(0) = Trim(txtUserName.Text)
rs.Fields(1) = Trim(txtNewPass2.Text)
rs.Fields(2) = 0
rs.Update
rs.Close
MsgBox "恭喜您注冊(cè)成功!"
Me.Hide
End If
End Sub
Private Sub Exit_Click() '取消
Unload Me
End Sub
Private Sub Exit_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdExit.BorderStyle = 1
End Sub
Private Sub Exit_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdExit.BorderStyle = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
conn.Close
Set rs = Nothing
End Sub
Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER=SQL Server;UID=sa;DATABASE=xs;WSID=B86;APP=Microsoft Data Access Components;SERVER=B86"
conn.Open '打開(kāi)數(shù)據(jù)庫(kù)
End Sub
Private Sub Form_Activate()
txtUserName.Text = ""
txtUserName.SetFocus
txtNewPass1.Text = ""
txtNewPass2.Text = ""
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -