如何赞美别人拍的照片:一个有关VB的问题

来源:百度文库 编辑:中科新闻网 时间:2024/05/09 17:41:43
Public Modify As Boolean
Public OriUser As String
Private Sub Cancel_Click()
Unload Me
End Sub
Private Sub OK_Click()
If Trim(txtUserName) = "" Then
MsgBox "请输入用户名"
txtUserName.SetFocus
Exit Sub
End If
If Len(txtPass) < 6 Then
MsgBox "密码长度不能小于6"
txtPass.SetFocus
txtPass.SelStart = 0
txtPass.SelLength = Len(txtPass2)
Exit Sub
End If
If txtPass <> txtPass2 Then
MsgBox "密码和确认密码不相同,请重新确认"
txtPass2.SetFocus
txtPass2.SelStart = 0
txtPass2.SelLength = Len(txtPass2)
Exit Sub
End If
'判断是否存在同名用户
With MyUser
If Modify = False Or OriUser <> Trim(txtUserName) Then
If .In_DB(Trim(txtUserName)) = True Then
MsgBox "用户名已经存在,请重新输入"
txtUserName.SetFocus
txtUserName.SelStart = 0
txtUserName.SelLength = Len(txtUserName)
Exit Sub
End If
End If
'将用户数据赋值到MyUser对象中
.username = MakeStr(txtUserName)
.Pwd = MakeStr(txtPass)
Select Case ComboType.Text
Case "系统管理员"
.User_type = 1
Case "普通用户"
.User_type = 2
End Select
'保存用户数据
If Modify = False Then
.Insert
Else
.Update (OriUser)
'如果修改自身用户名,则更新CurUser对象
If OriUser = CurUser.username And Trim(txtUserName) <> OriUser Then
CurUser.username = Trim(txtUserName)
CurUser.GetInfo (CurUser.username)
End If
End If
End With
MsgBox "数据保存成功"
Unload Me
End Sub
这一段一运行为什么总说makestr这个函数未定义

Private Function MakeStr(ByVal Str11 As String) As String
MakeStr = Trim(Replace(Str11, "'", "''"))
End Function
楼上的说法也不对,Str是VB的内置函数,给他起个别的名字.

Public OriUser As String
在它后面加个
Public Function MakeStr(ByVal Str As String) As String
MakeStr = Trim(Replace(Str, "'", "''"))
End Function
试试看吧