Windows Forms - get Text value from object of type button

后端 未结 3 2012
悲&欢浪女
悲&欢浪女 2021-01-15 04:24

I have a Windows form named Form1 and panel within this form named panel1. I use the panel only to place buttons there so that I can group them and

3条回答
  •  时光取名叫无心
    2021-01-15 04:54

        private void HandleClick(object sender, EventArgs e)
        {
            var btn = sender as Button;
            if (btn != null)
            {
                MessageBox.Show(btn.Text);
            }
        }
    

提交回复
热议问题