vb 对话框 窗体在form1里按下command1后弹出msgbox确定对话框,确定后返回form1
答案:3 悬赏:20 手机版
解决时间 2021-03-13 00:34
- 提问者网友:王者佥
- 2021-03-12 11:38
vb 对话框 窗体在form1里按下command1后弹出msgbox确定对话框,确定后返回form1,再次按下command1后则弹出form2要怎么实现 啊,我弄的总是msgbox跟form2一起弹出,求大侠讲的详细具体点啊,本人菜菜鸟
最佳答案
- 五星知识达人网友:玩家
- 2021-03-12 12:29
Option Explicit
Dim BoL_butClick As Boolean
Private Sub Command1_Click()
Select Case BoL_butClick
Case False
MsgBox ""
Command1.Caption = "点击打开窗口2"
Case True
Load Form2
Form2.Show 1
Command1.Caption = "点击弹出对话框"
End Select
BoL_butClick = Not BoL_butClick
End Sub
Private Sub Form_Load()
Command1.Caption = "点击弹出对话框"
End Sub
Dim BoL_butClick As Boolean
Private Sub Command1_Click()
Select Case BoL_butClick
Case False
MsgBox ""
Command1.Caption = "点击打开窗口2"
Case True
Load Form2
Form2.Show 1
Command1.Caption = "点击弹出对话框"
End Select
BoL_butClick = Not BoL_butClick
End Sub
Private Sub Form_Load()
Command1.Caption = "点击弹出对话框"
End Sub
全部回答
- 1楼网友:行路难
- 2021-03-12 14:49
多用一个变量
dim i
i=0
sub command1_Click.....
if i=0 then
msgbox ....
i=i+1
else
form2.show
end if
....
- 2楼网友:蓝房子
- 2021-03-12 13:19
'定义窗体级全局x,用来描述三种状态
'起始状态 x = 0 ,两个按钮都没有点过
'x=1 点过command1
'x=2 点过command2
dim x as integer
private sub command1_click()
'点击command1判断一下点击前的状态
if x = 0 then
msgbox "先点command1"
end if
x = 1
end sub
private sub command2_click()
'点击command1判断一下点击前的状态
if x = 0 then
msgbox "先点command2"
end if
if x = 1 then
unload me
end if
x = 2
end sub
private sub form_load()
x = 0 '窗体加载设置初始状态
end sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯