简体   繁体   English

C#-如何为已动态创建的文本框编写离开事件

[英]C# - How to write a Leave Event for a textbox that has been created dynamically

I have a dynamically created text box. 我有一个动态创建的文本框。 I want to register a function on the Leave event. 我想在Leave事件上注册一个函数。 How do I do that? 我怎么做?

textbox = new TextBox();

try: 尝试:

 textbox.Leave += new EventHandler(textBoxLeave);

actual handler: 实际的处理程序:

    private void textBoxLeave(object sender, EventArgs e)
    {
        // put your code here
    }  

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 c#-如果已创建SQL查询,则在文本框中显示消息 - c# - Display message on textbox if SQL query has been created 如何知道特定文本框中是否有更改,该文本框是在C#中动态创建的 - How to know if there is a changes in a specific textbox, the textbox is dynamically created in C# 如何在C#Windows窗体中删除动态创建的文本框和标签? - How to remove dynamically created textbox and labels in C# Windows Forms? 如何在C#Windows窗体中使用动态创建的Button / textBox? - How to Use Dynamically Created Button/textBox in C# Windows Forms? C# 删除最后一个动态创建的文本框 - C# remove last dynamically created textbox 与C#中的文本框的已验证或离开事件有关的问题 - Issue Related to Validated or Leave event of Textbox in C# 如何检查是否已创建类实例或为空C# - How to check if a class instance has been created or is null C# 如何在WPF C#中检索动态创建的文本框的文本并将其显示为动态创建的按钮的内容 - How to retrieve the text of a dynamically created textbox and display its as a content of dynamically created button in wpf c# 使用C#和XAML无法在按钮单击事件上获得动态创建的textbox.text数据 - Unable to get dynamically created textbox.text data on button click event using c# and XAML 如何在C#中为动态创建的用户控件创建单击事件? - How to create click event for dynamically created user controls in C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM