更新时间:2023-12-05 10:14:28
在Click事件处理程序中,您将有一个参数"sender"-这是导致事件的TextBox:
In the Click event handler, you will have a parameter "sender" - this is the TextBox that caused the event:
TextBox t = sender as TextBox;
if (t != null)
{
Console.WriteLIne(t.Text);
}
在TextBox
的Click
事件处理程序中使用以下代码
Use the following code in theClick
event handler of theTextBox
void t_Click(object sender, EventArgs e)
{
TextBox t1 = (TextBox)sender;
string str = t1.Text;
}