我做了一个用户管理界面,设想是选中datalist中的用户名,然后点击修改用户按钮,就可以修改用户密码,但现在情况是,一点击用户修改,就跳出编译错误,参数不可选,下面是修改用户按钮的代码
Private Sub command2_click()
Dim iret As Integer
If dltuser.Text = "" Then
MsgBox "请选择要修改的用户!", vbOKOnly + vbCritical, "警告"
Exit Subcuruser.strname = myuser.strname
With frmupdateuser
.Caption = "修改密码"
.strolduser = curuser.strname
.Text1.Text = Trim(curuser.strname)
.Text1.Enabled = False
Select Case curuser.iuserclass
Case 1
.Combo1.AddItem = "管理员"
Case 2
.Combo1.AddItem = "客户"
End Select
.Combo1.ListIndex = 0
.Combo1.Enabled = False
.bmodify = True
.Show 1
End WithExit SubWith frmupdateuser
.strolduser = myuser.strname
.Text1.Text = myuser.strname
.Text2.Text = myuser.strpwd
.Text3.Text = myuser.strpwd
Caption = "修改用户信息"
.Combo1.AddItem "管理员"
.Combo1.AddItem "客户"
.Combo1.ListIndex = myuser.iuserclass - 1
.bmodify = True
.Show 1
End With
Case 2
If myuser.iuserclass = 1 Then
MsgBox "对不起,您没有权限修改该用户!", vbOKOnly + vbCritical, "警告"
Else
With frmupdateuser
.strolduser = myuser.strname
.Text1.Text = myuser.strname
.Text2.Text = myuser.strpwd
.Text3.Text = myuser.strpwd
Caption = "修改用户信息"
.Combo1.AddItem "客户"
.Combo1.AddItem "客户"
.Combo1.ListIndex = 0
.bmodify = True
.Show 1
End With
End If
End Select
Adodc1.Refresh
datarefresh
dltuser_click
End Sub
就是这个combo1.additem出错,不知道改怎么办?麻烦各位了。