VB通讯录管理系统 第6页
Dim aa As String
If Trim(Text1.Text) = "" Then
MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
Else
Data1.RecordSource = "select * from load where name='" & aa & "'"
While Data1.Recordset.EOF = False
If Trim(Data1.Recordset.Fields(0)) = Trim(Text1) Then
MsgBox "用户已经存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Text2.Text = ""
Text1.Text = ""
Text3.Text = ""
Exit Sub
Else
Data1.Recordset.MoveNext
End If
Wend
End If
If Trim(Text2.Text) <> Trim(Text3.Text) Then
MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Text2.Text = ""
Text3.Text = ""
Exit Sub
Else
If Text2.Text = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Text2.Text = ""
Text3.Text = ""
Else
Data1.Recordset.AddNew
Data1.Recordset.Fields("name") = Trim(Text1.Text)
Data1.Recordset.Fields("passwd") = Trim(Text2.Text)
Data1.Recordset.Update
MsgBox "恭喜你,注册成功!", vbOKOnly + vbExclamation, "添加用户"
Unload Me
End If
End If
End SubPrivate Sub Picture3_Click()
Unload Me
End SubPrivate Sub Picture4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text3.SetFocus
End Sub5.3.2.2 资料添加功能的实现
资料添加的界面如下:
图5.3.2.2
此功能实现资料的添加功能,在此界面中的文本框中填入相应的资料信息,然后点击提交按钮,系统就把相应的图信息添加到数据库中。此界面主要是由Data数据控制项完成的,界面的文本框与Data相连接,以实现资料添加。提交按钮的相应代码如下:
Private Sub Picture5_Click()
If Trim(Text1.Text) = "" Then
MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Else
Data1.RecordSource = "select * from load where name='" & Trim(Text1.Text) & "'"
If Data1.Recordset.RecordCount <> 0 Then
MsgBox "用户已经存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Text1.Text = ""
Else
Data1.Recordset.MoveLast “记录下移一条”
ans = MsgBox("个人资料添加成功", 64, "提示")
Data1.Recordset.Edit
Data1.Recordset.AddNew
Data1.Recordset.Update
Data1.Refresh
End If
End If
End Sub
5.3.3.3 用户密码修改功能的实现
界面图如下:
图5.3.3.3
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
VB通讯录管理系统 第6页下载如图片无法显示或论文不完整,请联系qq752018766