会VB的来

[复制链接]
查看11 | 回复5 | 2010-10-6 19:36:31 | 显示全部楼层 |阅读模式
一个登陆账号密码的代码.
Private Sub Command1_Click()
If Text1.Text = "12345" And Text2.Text = "123" Then
Me.Hide
Form2.Show
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "通行证和密码不能为空!", vbApplicationModal, "错误"
Else
MsgBox "请正确输入通行证和密码", vbApplicationModal, "错误"
(从这里怎么结尾??)说明白

回复

使用道具 举报

千问 | 2010-10-6 19:36:31 | 显示全部楼层
代码应该是这样的吧……一个Sub对应着一个End Sub 一个If对应着一个End If当然,如果是If A0 Then End 这类语句就可以不用End IfPrivate Sub Command1_Click()'一个SubIf Text1.Text = "12345" And Text2.Text = "123" Then '这里开始有个IfMe.HideForm2.ShowEnd if '这个End If 是对应着上面的那个IfIf Text1.Text = "" And Text2.Text = "" Then ’这里也是一个ifMsgBox "通行证和密
回复

使用道具 举报

千问 | 2010-10-6 19:36:31 | 显示全部楼层
Private Sub Command1_Click()'你顺序错了,得这样:If Text1.Text = "" And Text2.Text = "" Then MsgBox "通行证或密码不能为空!", vbApplicationModal, "错误"Else if text1.text "12345" then'判断帐号
回复

使用道具 举报

千问 | 2010-10-6 19:36:31 | 显示全部楼层
Private Sub Command1_Click()If Text1.Text = "12345" And Text2.Text = "123" ThenMe.HideForm2.Showend ifIf Text1.Text = "" And Text2.Text = "" ThenMsgBox "通行证和密码不能为空!", v
回复

使用道具 举报

千问 | 2010-10-6 19:36:31 | 显示全部楼层
我是学易语言的 也懂点vb由于我没有安装vb,所以用记事本写了个,没有测试if text1.text="" thenmsgbox "帐号不能为空",64,"提示" elseif text2.text="" then
msgbox "密码不能为空",64,“提示”
else
if text1.t
回复

使用道具 举报

千问 | 2010-10-6 19:36:31 | 显示全部楼层
把中间那个if改为Elseif, 然后在最后加一个End If 即可。或者在最后直接连续加两个End If.因为整体可以作为镶嵌If语句使用
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行