求一个完整的VB程序.要求如下
用VB编写的程序:要求,一个名为form的窗体上画两个命令按钮,编写适当的事件过程,运行后,一个按钮显示,另一个按钮隐藏;点击显示的按钮,此按钮隐藏,另一个显示,同样点击这个显示的按钮,这个按钮隐藏,另一个显示!
要完整的代码,谢谢!
[解决办法]
放三个按钮,第三个记大点。
Private Sub Command1_Click() Command1.Visible = False: Command2.Visible = True: Command3.Caption = "第一个按钮隐藏了,第二个显示了"End SubPrivate Sub Command2_Click() Command1.Visible = True: Command2.Visible = False: Command3.Caption = "第二个按钮隐藏了,第一个显示了"End SubPrivate Sub Command3_Click() Command1.Visible = True: Command2.Visible = True: Command3.Caption = "两个按钮都显示了"End SubPrivate Sub Form_Load() Command1.Caption = "我显示了": Command2.Caption = "我显示了": Command3.Caption = "两个都显示了!"End Sub
[解决办法]
Private Sub Command1_Click()Form1.Command2.Visible = True: Form1.Command1.Visible = FalseEnd SubPrivate Sub Command2_Click()Form1.Command1.Visible = True: Form1.Command2.Visible = FalseEnd SubPrivate Sub Form_Load()Form1.Command1.Caption = "显示按钮2"Form1.Command2.Caption = "显示按钮1"End Sub
[解决办法]
Private Sub Command1_Click()
Command1.Visible = Command2.Visible
Command2.Visible = Not Command1.Visible
End Sub
Private Sub Command2_Click()
Command2.Visible = Command1.Visible
Command1.Visible = Not Command2.Visible
End Sub
Private Sub Form_Load()
Command1.Visible = True
Command2.Visible = False
End Sub