vb6.0中编写如下代码出现子函数或函数未定义是怎么回事
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Public scan As String
Private Sub cmdAdd_Click()
frmuser.Height = 7605
frmuser.Width = 6135
End Sub
Private Sub cmdCancel_Click()
frmuser.Height = 4530
frmuser.Width = 6180
End Sub
Private Sub cmdCancel1_Click()
frmuser.Height = 4530
frmuser.Width = 6180
End Sub
Private Sub cmdDelect_Click()
On Error Resume Next
If Adodc1.Recordset.EOF = False Then
K = MsgBox("真的要删除当前记录吗?", vbYesNo + vbQuestion, "警告")
If K = 6 Then '点击“是”
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
Sleep (500)
Adodc1.Refresh
End If
Else
MsgBox "系统提示:所有记录已经删除。"
End If
End Sub
Private Sub cmdEdit_Click()
On Error Resume Next
If scan = "" Then
MsgBox "请选择需要修改的密码的用户!"
Exit Sub
Else
frmuser.Width = 12105
frmuser.Height = 4530
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
On Error Resume Next
Dim sc As Integer
If Not (Testtxt(txtUserName.Text) Or Testtxt(txtPassword.Text) Or Testtxt(txtPasswordAgain.Text) Or Testtxt(cmbClass.Text)) Then
MsgBox "为了保证用户资料安全,请认真核对每项数据!", vbOKOnly + vbExclamation, "警告"
txtNo.SetFocus
Exit Sub
End If
If txtPassword.Text <> txtPasswordAgain.Text Then
MsgBox "两次输入的密码不相同,请您重新核对!"
Exit Sub
End If
sc = MsgBox("确实要添加这条记录吗?", vbOKCancel, "提示信息")
If sc = 1 Then
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
rs.CursorLocation = adUseClient
Str1 = "Provider=Microsoft.Jet.OLEDB.4.0;"
Str2 = "Data Source=" + App.Path + "\data.mdb;"
Str3 = "Jet OLEDB:Database Password=harry2000"
conn.Open Str1 & Str2 & Str3
Strsql = "select * from user"
rs.Open Strsql, conn, 3, 3
rs.AddNew
rs!user_id = txtUserName.Text
rs!user_pwd = txtPassword.Text
rs!user_des = cmbClass.Text
rs.Update
rs.Close
conn.Close
MsgBox ("添加用户成功!")
Adodc1.Refresh
End If
txtUserName.Text = ""
txtPassword.Text = ""
cmbClass.Text = ""
txtPasswordAgain.Text = ""
frmuser.Height = 4530
frmuser.Width = 6180
End Sub
Private Sub cmdSave1_Click()
On Error Resume Next
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
If Not (Testtxt(txtOldPassword.Text) Or Testtxt(txtNewPassword.Text) Or Testtxt(txtNewPasswordAgain.Text) Or Testtxt(cmbNewClass.Text)) Then
MsgBox "数据不完整,请认真核对!", vbOKOnly + vbExclamation, "警告"
txtNo.SetFocus
Exit Sub
End If
rs.CursorLocation = adUseClient
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.mdb;Jet OLEDB:Database Password="
cn.Open ConnectionString
rs.Open "select * from Admin where 编号 = '" & scan & "'", cn, adOpenKeyset, adLockOptimistic
If txtOldPassword.Text <> rs!密码 Then
MsgBox "原密码输入错误,请重新输入!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
rs!user_pwd = txtNewPassword.Text
rs!user_des = cmbNewClass.Text
rs.Update
Sleep (500)
Adodc1.Refresh
sc = MsgBox("修改成功", vbOKCancel, "提示信息")
End If
frmuser.Height = 4530
frmuser.Width = 6180
End Sub
Private Sub DataGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
DataGrid1.Row = DataGrid1.RowContaining(Y)
scan = DataGrid1.Columns(0).Text
End Sub
Private Sub Form_Load()
frmuser.Height = 4530
frmuser.Width = 6180
End Sub
Private Sub Form_Resize()
Me.Left = 0
Me.Top = 0
End Sub
那一行有问题?能说下 单步调试,发现什么地方出错再问嘛。
初学者一定要有耐性,这样才能快速进步。
补充:VB , 控件