[英]Raise an event when button is clicked in windows forms
I am making an user interface from windows forms (c#).In my form there are many buttons named enable (for enable each textbox).What i need to do here is when the button relevant to textbox is clicked enable the textbox.(they are not in a groupBox). 我正在从Windows窗体(c#)制作用户界面。在窗体中有许多名为enable(用于启用每个文本框的按钮)。我需要做的是单击与文本框相关的按钮时启用文本框。不在groupBox中)。 Without manually coding in each button click's method how can i do this in a programmatic way
没有在每个按钮单击的方法中手动编码,我该如何以编程方式进行此操作
Assuming you are trying to bind a textBox's enable property to a button, I would recommend you yo build a simple custom userConrol. 假设您尝试将textBox的enable属性绑定到按钮,则建议您构建一个简单的自定义userConrol。 Inside that control you will be able to bind the logic of the button to the TextBox.
在该控件内,您将能够将按钮的逻辑绑定到TextBox。 You can then add any number of that specific UserControl to your application and it will automaticly bind your button's logic to the textBox.
然后,您可以将任意数量的该特定UserControl添加到您的应用程序中,它将自动将按钮的逻辑绑定到textBox。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.