父母子女形式

编程入门 行业动态 更新时间:2024-10-15 06:21:13
本文介绍了父母子女形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

向大家问好 我以form1作为父母,而我的孩子则是form2 在form1的按钮单击事件上,显示了form2的一个实例,并且该按钮被拒绝以不显示另一个实例,我想在form2的示例关闭时再次启用该按钮,我的用户可以单击它. 在form2的关闭表单上,我编写此代码

hello to all i have form1 as parent and my child form is form2 on a button click event of form1 , an instance of form2 shows and the button is disabeld to dont show another instance , i want to when sample of form2 is closing the button is enabeled again and my user can click it on. on the form closing of form2 i write this code

private form2_closing(object sender , formclosingeventargs e) { form1.buttonname.enabeld=true; }

但这不起作用 请帮帮我. 谢谢.

but it does not work please help me. Thanks.

推荐答案

更改它:将处理程序移到form1中: Form1按钮单击事件: Change it: move the handler into form1: Form1 button click event: Form2 f = new Form2(); f.FormClosing += new FormClosingEventHandler(Form2_FormClosing); myButton.Enabled = false; f.Show();

然后将处理程序添加到Form1:

Then add the handler to Form1:

void Form2_FormClosing(object sender, FormClosingEventArgs e) { myButton.Enabled = true; }

更多推荐

父母子女形式

本文发布于:2023-10-28 03:58:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535447.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:子女   形式   父母

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!