启用按钮从一种形式到另一种形式

问题描述:


我在form1中有一个按钮,最初在form1_load()中,我禁用了该按钮.在form2中完成某些操作后,我需要在form1中启用按钮.
该怎么做?

我为form1创建了对象,并尝试启用它,就像在form2中一样.


i have a button in form1, initially in form1_load() i disabled that button. At the end of the certain operations which was done in form2, i need to enable the button in form1.
How to do this?

I created object for form1 and tried to enables it, in form2 like..

form2_load()
{
...
...
Form1 a=new Form1();
a.button1.enable=true;
}



但这不起作用.



But it not works.

这是一个很普遍的问题.表单协作的最可靠方法是在表单类中实现某些接口.

请在这里查看我过去的答案,另请参阅其他解决方案和讨论:
如何在列表框之间复制所有项目两种形式 [ ^ ].

—SA
This is a popular question. The most robust way of form cooperation is implementing some interface in the form class.

Please see my past answer here, see also other solutions and the discussion:
How to copy all the items between listboxes in two forms[^].

—SA


已答应将其从未答复"列表中移出:OP找到了解决方案.
Answered only to move it from the Unanswered list: OP found solution.


是的...我有解决办法



http://www.codeproject.com/Questions/119349/how-to-enable-the-buttons-which-are-in-parent-form.aspx
yes...i got a solution



http://www.codeproject.com/Questions/119349/how-to-enable-the-buttons-which-are-in-parent-form.aspx