用vb做登录页面成功后进入另一个界面,要求在界面上显示用户姓名怎么做
我用的是access数据表,有用户账号,密码,用户姓名,登录的时候连的是用户账号、密码。登陆成功后在form2界面上显示对应的用户姓名登录代码如PrivateSubCom...
我用的是access数据表,有用户账号,密码,用户姓名,登录的时候连的是用户账号、密码。登陆成功后在form2界面上显示对应的用户姓名登录代码如Private Sub Command1_Click()
Dim U As Boolean, P As Boolean, Ok As Boolean
With Adodc1
.Refresh
Do While Not .Recordset.EOF
U = .Recordset.Fields(1).Value = Text1.Text '
P = .Recordset.Fields(2).Value = Text2.Text '
If U And P Then
Ok = True
Exit Do
Else
.Recordset.MoveNext
End If
Loop
End With
If Ok Then
Form2.Show
Form2.Caption = "姓名:"
Form1.Hide
Else
MsgBox "登录失败"
End If
End Sub 展开
Dim U As Boolean, P As Boolean, Ok As Boolean
With Adodc1
.Refresh
Do While Not .Recordset.EOF
U = .Recordset.Fields(1).Value = Text1.Text '
P = .Recordset.Fields(2).Value = Text2.Text '
If U And P Then
Ok = True
Exit Do
Else
.Recordset.MoveNext
End If
Loop
End With
If Ok Then
Form2.Show
Form2.Caption = "姓名:"
Form1.Hide
Else
MsgBox "登录失败"
End If
End Sub 展开
1个回答
展开全部
Private Sub Command1_Click()
If Text1 = "" And Text2 = "" Then
Form2.Show '进入窗体2
Form1.Hide '关闭窗体1
Else
MsgBox "对不起,输入有误,奖退出!"
End
End If
End Sub
数据库我不会``sorry
Private Sub Form_Load()
Label1 = "用户名:"
Label2 = "密码"
Text1 = ""
Text2 = ""
Command1.Caption = "确定"
End Sub
If Text1 = "" And Text2 = "" Then
Form2.Show '进入窗体2
Form1.Hide '关闭窗体1
Else
MsgBox "对不起,输入有误,奖退出!"
End
End If
End Sub
数据库我不会``sorry
Private Sub Form_Load()
Label1 = "用户名:"
Label2 = "密码"
Text1 = ""
Text2 = ""
Command1.Caption = "确定"
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询