显示模态,然后再次显示 [英] Show Modal, then Again

查看:76
本文介绍了显示模态,然后再次显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,


VB.Net 2003

我想从Form1以模态方式打开一个表单(Form2),然后从Form2

以模态显示Form3。似乎一旦我打开第三个表格然后

关闭它,第二个表格也会关闭。如何防止发生这种情况?


我想我必须创建一个模态助手。这将以模态方式打开

所需的表格,等待它关闭,然后将结果返回给

来电者。我是否走在正确的轨道上?

TIA

Hello Everyone,

VB.Net 2003

I would like to open a form (Form2) modally from Form1, then from Form2
display Form3 modally. It seems that once I open that third form and then
close it, the second form also closes. How can I prevent that from
happening?

I am thinking that I have to create a "Modal Helper" that will open the
desired form modally, wait for it to close and then return a result to the
caller. Am I on the right track?
TIA

推荐答案

" AMDRIT" <是**** @ hotmail.com> schrieb
"AMDRIT" <am****@hotmail.com> schrieb
Hello Everyone,

VB.Net 2003

我想从Form1以模态方式打开一个表单(Form2),然后从
形式然后关闭它,第二个形式也会关闭。我怎样才能防止这种情况发生?
Hello Everyone,

VB.Net 2003

I would like to open a form (Form2) modally from Form1, then from
Form2 display Form3 modally. It seems that once I open that third
form and then close it, the second form also closes. How can I
prevent that from happening?



您是否设置了Button的Dialogresult属性,其中显示了''Click事件

Form3?

Armin


Did you set the Dialogresult property of the Button in which''s Click event
you show Form3?
Armin


我手动设置每个表单的对话结果;我没看到

如何设置值(默认为Cancel)会终止上一个表单的模态

对话框。

Private Sub cmdOk_Click(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理cmdOk.Click

Me.DialogResult = DialogResult.OK

Me.Close()

End Sub


Private Sub cmdCancel_Click(ByVal sender As System.Object,ByVal e As

System.EventArgs)处理cmdCancel.Click

Me.DialogResult = DialogResult.Cancel

Me.Close()

End Sub



" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道

news:%2 **************** @ tk2msftngp13.phx.gbl ...
I manually set the dialogresult of each form, however; I fail to see how
setting the value (which is Cancel by default) would terminated the modal
dialog of the previous form.
Private Sub cmdOk_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdOk.Click
Me.DialogResult = DialogResult.OK
Me.Close()
End Sub

Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCancel.Click
Me.DialogResult = DialogResult.Cancel
Me.Close()
End Sub


"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
" AMDRIT" <是**** @ hotmail.com> schrieb
"AMDRIT" <am****@hotmail.com> schrieb
Hello Everyone,

VB.Net 2003

我想从Form1以模态方式打开一个表单(Form2),然后从
形式然后关闭它,第二个形式也会关闭。我怎样才能防止这种情况发生?
Hello Everyone,

VB.Net 2003

I would like to open a form (Form2) modally from Form1, then from
Form2 display Form3 modally. It seems that once I open that third
form and then close it, the second form also closes. How can I
prevent that from happening?



您是否设置了Button的Dialogresult属性,其中'Click事件
显示Form3?

Armin


Did you set the Dialogresult property of the Button in which''s Click event
you show Form3?
Armin



>来自DialogResult的文档(强调我的):


表单的对话结果是当表单显示为模式对话框时从表单

返回的值。


注意这一部分:


如果表单显示为对话框,则使用DialogResult枚举中的

值设置此属性将设置对话框的值
$ b表单的$ b结果,隐藏模态对话框,并将控制权返回到

调用表单。

>From the docs for DialogResult (emphasis mine):

The dialog result of a form is the value that is returned from the form
when it is displayed as a modal dialog.

Note this part:

If the form is displayed as a dialog box, setting this property with a
value from the DialogResult enumeration sets the value of the dialog
result for the form, hides the modal dialog, and returns control to the
calling form.


这篇关于显示模态,然后再次显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆