gpt4 book ai didi

c# - 多个按钮调用相同的功能,可以找出哪个按钮调用了该功能吗?

转载 作者:太空宇宙 更新时间:2023-11-03 17:43:53 25 4
gpt4 key购买 nike

我有5个按钮,这些按钮将调用此弹出功能来发送电子邮件。如何找出哪个单击的按钮称为函数?

   public void popup(object sender, EventArgs e)
{

if (MessageBox.Show("You may not Bind, Change, Or Alter Insurance Coverage through e-mail. Confirmation of this e-mail by us initiates any changes to your Insurance. If you need any immediate service please contact our office at 1-800-875-5720.", "IMPORTANT!", MessageBoxButtons.OKCancel) == DialogResult.OK)
{

{
string email = "mailto:davidadfa.t@ifdafdadf.com";
Process.Start(email);
}
}
}

最佳答案

事件处理程序上的sender对象将是按下的按钮

Button b = sender as Button;

关于c# - 多个按钮调用相同的功能,可以找出哪个按钮调用了该功能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10044447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com