控制多个Windows窗体 [英] Controling Multiple Windows Forms

查看:95
本文介绍了控制多个Windows窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


情况:

我的程序中的主窗体上有一个下拉列表。我有另一个表格

用于输入一个新项目,该项目将位于主要

表格的下拉列表中。当在第二个表单上单击添加项目按钮时,第二个

表单将关闭,但我还希望主表单重新绑定

下拉列表中的数据。


我不知道如何告诉主窗体重新绑定来自

form2_Closed事件的数据。


当我谷歌这个问题时,我得到了大量关于MDI的信息,但这不是我正在寻找的

情况。


我也查了一下form1.FromHandle(form2)但是我不知道如何获得一个表单的句柄,或者即使这是一个合适的方式来解决这个问题。 />
这个。


提前致谢,


- Paul

解决方案

我可能需要改写这个...


我想访问我从父母那里创建的函数/>
表单(不是MDI父/子,但form1实例化一个新表单2)。


谢谢,


- Paul


" Paul Daly(MCP)"写道:

你好,

情况:
我的程序中的主窗体上有一个下拉列表。我有另一个表格
用于输入一个新项目,该项目将位于主要表格的下拉列表中。当在第二个表单上单击添加项目按钮时,第二个
表单将关闭,但我还希望主表单重新绑定下拉列表中的数据。

我不知道如何告诉主窗体重新绑定
form2_Closed事件中的数据。

当我谷歌这个问题时,我得到了大量有关MDI的信息,但那是不是我正在寻找的情况。

我也看过form1.FromHandle(form2)但我不知道如何获得
表格的处理方式,或者即使这是适当的方式。

提前致谢,

- 保罗



我找到了解决这个问题的方法...在form1上,我调用我想要的逻辑

当form2或3或4关闭时发生form1_Activated发生。


仍然好奇如何做到这一点...


谢谢


Paul Daly(MCP)写道:

你好,

情况:
我的程序中的主窗体上有一个下拉列表。我有另一个表格
用于输入一个新项目,该项目将位于主要表格的下拉列表中。当在第二个表单上单击添加项目按钮时,第二个
表单将关闭,但我还希望主表单重新绑定下拉列表中的数据。

我不知道如何告诉主窗体重新绑定
form2_Closed事件中的数据。

当我谷歌这个问题时,我得到了大量有关MDI的信息,但那是不是我正在寻找的情况。

我也看过form1.FromHandle(form2)但我不知道如何获得
表格的处理方式,或者即使这是适当的方式。

提前致谢,

- 保罗



问候Paul,


问题:Form2是否显示为模态?如果是这样,您可以使用

DialogResult来检查用户是否以可行的方式关闭对话框。

只需在使用Modal时添加Me.Hide()关于OnClose

活动。


问候,


Paulo


Hello,

Situation:
I have a drop down list on a main form in my program. I have another form
for entering a new item that will reside in the drop down list of the main
form. When the Add item button is clicked on the second form, the second
form closes, but I also want the main form to rebind the data in the drop
down list.

I''m not sure how to tell the main form to rebind the data from the
form2_Closed event.

When I google this problem I get a ton of info on MDI, but that is not the
situation I''m looking for.

I''ve also looked into form1.FromHandle(form2) but I don''t know how to get
the handle of a form, or even if this is the appropriate way of going about
this.

Thanks in advance,

- Paul

解决方案

I might need to rephrase this...

I would like to access functions I''ve created in a parent form from a child
form (not MDI parent/child, but form1 instantiates a new form2).

Thanks,

- Paul

"Paul Daly (MCP)" wrote:

Hello,

Situation:
I have a drop down list on a main form in my program. I have another form
for entering a new item that will reside in the drop down list of the main
form. When the Add item button is clicked on the second form, the second
form closes, but I also want the main form to rebind the data in the drop
down list.

I''m not sure how to tell the main form to rebind the data from the
form2_Closed event.

When I google this problem I get a ton of info on MDI, but that is not the
situation I''m looking for.

I''ve also looked into form1.FromHandle(form2) but I don''t know how to get
the handle of a form, or even if this is the appropriate way of going about
this.

Thanks in advance,

- Paul



I found a way around this problem... On form1, I call the logic I want to
occur when form2 or 3 or 4 closes when form1_Activated occurs.

Still curious about how to do this though...

Thanks

"Paul Daly (MCP)" wrote:

Hello,

Situation:
I have a drop down list on a main form in my program. I have another form
for entering a new item that will reside in the drop down list of the main
form. When the Add item button is clicked on the second form, the second
form closes, but I also want the main form to rebind the data in the drop
down list.

I''m not sure how to tell the main form to rebind the data from the
form2_Closed event.

When I google this problem I get a ton of info on MDI, but that is not the
situation I''m looking for.

I''ve also looked into form1.FromHandle(form2) but I don''t know how to get
the handle of a form, or even if this is the appropriate way of going about
this.

Thanks in advance,

- Paul



Greetings Paul,

Question: Is the Form2 shown as Modal? If so you can use the
DialogResult to check if the user closed the dialog in a workable way.
Just make suere that when using Modal, add Me.Hide() on the OnClose
event.

Regards,

Paulo


这篇关于控制多个Windows窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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