VB的程序做窗体

来源:百度知道 编辑:UC知道 时间:2024/05/26 05:21:21
Private Sub Command1_Click() ‘登录按钮代码
Form2.Visible = True
Form1.Visible = False
Form2.Label1.Caption = "你已登录"
Form2.Label2.Caption = "用户名:" & Text1.Text
Form2.Label3.Caption = "密码为:" & Text2.Text
End Sub

如何用那几个基本的操作啊,我做不出来那几个效果出来做一个登陆的效果

Dim i, j As Boolean
i = False
j = False
If Combo1.Text = "admin" And Text1.Text = "admin" Then
i = True
End If
If Combo1.Text = "user" And Text1.Text = "user" Then
j = True
End If

If i = True Or j = True Then
MsgBox "欢迎使用班级管理系统!"
Call PlaySound(App.Path + "\声音\5.wav", 0&, &H1)//这是登录音
Form1.Show
Unload Me
Else
MsgBox "密码错误!请重新输入!"
Text1.Text = ""
Text1.SetFocus
Text2.Text = Str(Val(Text2.Text) + 1)
If Val(Text2.Text) >= 3 Then
MsgBox "你的密码输入次数超过三次,系统将退出!"
End
End If
End If

你这个只是一个界面代码。。
核心判断你还没有加进去

首先是创立界面,把需要的控件都放进去。就像label1,2,3.

然后才是将代码放入。