VB 进入FORM2后怎么自动关闭FORM1?
我想要程序FORM1进入FORM2的时候,自动关闭自身。而且FORM2后退到FORM1的时候自动关闭自身。那下列程序应该加在哪里呢?我要隐藏程序~~~~`PrivateS...
我想要程序FORM1进入FORM2的时候,自动关闭自身。
而且FORM2后退到FORM1的时候自动关闭自身。
那下列程序应该加在哪里呢 ?我要隐藏程序~~~~`
Private Sub Command1_Click()
If Text1 = "123456" Then
MsgBox "密码正确,允许登录"
Load Form2
Form2.Show
Else
Text1 = ""
PassNum = PassNum + 1
MsgBox "警告:密码错误"
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
PassNum = 0
Text1 = ""
Text1.PasswordChar = "*"
Text1.MaxLength = 6
Command1.Caption = "登录"
Command1.Default = True
Me.Show
Text1.SetFocus
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日 " & Time & " 星期" & Weekday(Now) - 1
End Sub 展开
而且FORM2后退到FORM1的时候自动关闭自身。
那下列程序应该加在哪里呢 ?我要隐藏程序~~~~`
Private Sub Command1_Click()
If Text1 = "123456" Then
MsgBox "密码正确,允许登录"
Load Form2
Form2.Show
Else
Text1 = ""
PassNum = PassNum + 1
MsgBox "警告:密码错误"
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
PassNum = 0
Text1 = ""
Text1.PasswordChar = "*"
Text1.MaxLength = 6
Command1.Caption = "登录"
Command1.Default = True
Me.Show
Text1.SetFocus
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日 " & Time & " 星期" & Weekday(Now) - 1
End Sub 展开
展开全部
在Form1中只需对Private Sub Command1_Click()作如下修改
Private Sub Command1_Click()
If Text1 = "123456" Then
MsgBox "密码正确,允许登录"
Load Form2
Form2.Show
Form1.Hide '这是加的一句
Else
Text1 = ""
PassNum = PassNum + 1
MsgBox "警告:密码错误"
Text1.SetFocus
End If
End Sub
以下是Form2中的代码
Private Sub Form_Unload(Cancel As Integer)
Form1.Show
End Sub
Private Sub Command1_Click()
If Text1 = "123456" Then
MsgBox "密码正确,允许登录"
Load Form2
Form2.Show
Form1.Hide '这是加的一句
Else
Text1 = ""
PassNum = PassNum + 1
MsgBox "警告:密码错误"
Text1.SetFocus
End If
End Sub
以下是Form2中的代码
Private Sub Form_Unload(Cancel As Integer)
Form1.Show
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询