vb程序登陆界面代码出现“编译错误,参数不可选"是怎么回事。
PrivateSubCommand1_Click()Dimusename,password,respondAsStringusename=Text1.Textpasswo...
Private Sub Command1_Click()
Dim usename, password, respond As String
usename = Text1.Text
password = Text2.Text
If usename <> "ylz" Or password <> "123456" Then
respond = MsgBox
If respond = vbRetry Then
Text1.Text = ""
Text2.Text = ""
usename = ""
password = "'"
End If
If respond = vbCancel Then
End
End If
End If 展开
Dim usename, password, respond As String
usename = Text1.Text
password = Text2.Text
If usename <> "ylz" Or password <> "123456" Then
respond = MsgBox
If respond = vbRetry Then
Text1.Text = ""
Text2.Text = ""
usename = ""
password = "'"
End If
If respond = vbCancel Then
End
End If
End If 展开
展开全部
错误的地方是这段:respond = MsgBox
格式为:变量=msgbox("提示内容",提示图标或按钮,"标题内容")
从你上面的代码来看没有连接数据库建议这样写:
Private Sub Command1_Click()
if text1<>"ylz" then
msgbox "账号错误" ,64, "提示"
else
if text2<>"123456" then
msgbox "密码错误",48,"警告"
else
'这里就可以写打开另一个窗口,例如
form2.show
end if
end if
end sub
格式为:变量=msgbox("提示内容",提示图标或按钮,"标题内容")
从你上面的代码来看没有连接数据库建议这样写:
Private Sub Command1_Click()
if text1<>"ylz" then
msgbox "账号错误" ,64, "提示"
else
if text2<>"123456" then
msgbox "密码错误",48,"警告"
else
'这里就可以写打开另一个窗口,例如
form2.show
end if
end if
end sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询