combobox用代码添加不了项!
我的代码如下,但在编译时,我的下拉菜单一片空白!哪位大虾能求求小弟?OptionExplicitPublicintMyTimesAsIntegerConstMaxTime...
我的代码如下,但在编译时,我的下拉菜单一片空白!哪位大虾能求求小弟?
Option Explicit
Public intMyTimes As Integer
Const MaxTimes As Integer = 2
Public Sub FrmLogin_load()
intMyTimes = 1
cboUserName.AddItem "管理员"
cboUserName.AddItem "操作员1"
cboUserName.AddItem "操作员2"
End Sub
Private Sub CmdOK_click()
If cboUserName.Text <> "" Then
If FrmPwd.Text = "" Then
MsgBox "请输入密码!", , "提示窗口"
FrmPwd.SetFocus
Else
If FrmPwd.Text <> "11" Then
If intMyTimes > MaxTimes Then
MsgBox "你无权使用该软件!", , "提示窗口"
End
Else
intMyTimes = intMyTimes + 1
MsgBox "密码不正确,请重新输入!", , "提示窗口"
FrmPwd.SetFocus
End If
Else
MsgBox "登录成功!", , "提示窗口"
End If
End If
Else
MsgBox "操作员不能为空!", , "提示窗口"
Exit Sub
End If
End Sub
Private Sub CmdCancel_Click()
End
End Sub 展开
Option Explicit
Public intMyTimes As Integer
Const MaxTimes As Integer = 2
Public Sub FrmLogin_load()
intMyTimes = 1
cboUserName.AddItem "管理员"
cboUserName.AddItem "操作员1"
cboUserName.AddItem "操作员2"
End Sub
Private Sub CmdOK_click()
If cboUserName.Text <> "" Then
If FrmPwd.Text = "" Then
MsgBox "请输入密码!", , "提示窗口"
FrmPwd.SetFocus
Else
If FrmPwd.Text <> "11" Then
If intMyTimes > MaxTimes Then
MsgBox "你无权使用该软件!", , "提示窗口"
End
Else
intMyTimes = intMyTimes + 1
MsgBox "密码不正确,请重新输入!", , "提示窗口"
FrmPwd.SetFocus
End If
Else
MsgBox "登录成功!", , "提示窗口"
End If
End If
Else
MsgBox "操作员不能为空!", , "提示窗口"
Exit Sub
End If
End Sub
Private Sub CmdCancel_Click()
End
End Sub 展开
2个回答
展开全部
代码没有问题 你看一下是不是你的控件对象不对 比如是不是有两个控件 其实你赋值的这个对象是隐藏的 而可见的控件是另外一个对象
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询