【求助】VB多窗体之间的切换显示
有窗体A、B和C,它们都有D.showUnloadMe而D窗体有返回按钮,我想返回到最近上一次显示的窗体,该怎么办?...
有窗体A、B和C,它们都有
D.show
Unload Me
而D窗体有返回按钮,我想返回到最近上一次显示的窗体,该怎么办? 展开
D.show
Unload Me
而D窗体有返回按钮,我想返回到最近上一次显示的窗体,该怎么办? 展开
3个回答
展开全部
我想可以这样:先设一个全局变量Stau as string,
然后在A窗体的form_load事件中加入Stau=Stau+"a",在B窗体的form_load事件中加入Stau=Stau+"b",在C窗体的form_load事件中加入Stau=Stau+"c",再在返回按钮的click事件中加入:
dim r as string
r=right(Stau,1)
select case r
case "a"
form1.show
case "b"
form2.show
case "c"
form3.show
end select
r=left(r,len(r)-1)
这样每个窗体的打开状态和顺序都被在Stau中。
然后在A窗体的form_load事件中加入Stau=Stau+"a",在B窗体的form_load事件中加入Stau=Stau+"b",在C窗体的form_load事件中加入Stau=Stau+"c",再在返回按钮的click事件中加入:
dim r as string
r=right(Stau,1)
select case r
case "a"
form1.show
case "b"
form2.show
case "c"
form3.show
end select
r=left(r,len(r)-1)
这样每个窗体的打开状态和顺序都被在Stau中。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
昨天不是回复了吗?
form1:
Private
Sub
Command2_Click()
With
Form1
ct
=
.Top
cl
=
.Left
ch
=
.Height
cw
=
.Width
End
With
Form2.Show
Unload
Me
End
Sub
Private
Sub
Form_Load()
If
ct
=
0
And
cl
=
0
And
ch
=
0
And
cw
=
0
Then
Exit
Sub
With
Form1
.Top
=
ct
.Width
=
cw
.Left
=
cl
.Height
=
ch
End
With
End
Sub
form2:
Private
Sub
Command1_Click()
With
Form2
ct
=
.Top
cl
=
.Left
ch
=
.Height
cw
=
.Width
End
With
Form1.Show
Unload
Me
End
Sub
Private
Sub
Form_Load()
With
Form2
.Top
=
ct
.Width
=
cw
.Left
=
cl
.Height
=
ch
End
With
End
Sub
module:
Public
ch
As
Long
Public
ct
As
Long
Public
cw
As
Long
Public
cl
As
Long
form1:
Private
Sub
Command2_Click()
With
Form1
ct
=
.Top
cl
=
.Left
ch
=
.Height
cw
=
.Width
End
With
Form2.Show
Unload
Me
End
Sub
Private
Sub
Form_Load()
If
ct
=
0
And
cl
=
0
And
ch
=
0
And
cw
=
0
Then
Exit
Sub
With
Form1
.Top
=
ct
.Width
=
cw
.Left
=
cl
.Height
=
ch
End
With
End
Sub
form2:
Private
Sub
Command1_Click()
With
Form2
ct
=
.Top
cl
=
.Left
ch
=
.Height
cw
=
.Width
End
With
Form1.Show
Unload
Me
End
Sub
Private
Sub
Form_Load()
With
Form2
.Top
=
ct
.Width
=
cw
.Left
=
cl
.Height
=
ch
End
With
End
Sub
module:
Public
ch
As
Long
Public
ct
As
Long
Public
cw
As
Long
Public
cl
As
Long
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询