湖南株洲 小李布业 2019-07-30 21:48 采纳率: 50%
浏览 1000
已采纳

c# panel控件中radiobutton控件都check值如何获取

图片说明

我需要获取这两个panel中 radiobutton控件的check属性 到主窗体中 如何实现

或者在容器控件选择上是否有其他更好的选择 也可以示下

  • 写回答

3条回答

  • 发个福福 2019-07-31 08:47
    关注
      同一类型的radiobutton的_CheckedChanged 关联同一个处理函数
    
            //.design.cs
        this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
                this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
                this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton_CheckedChanged);
    
                //.cs
                string selectedItem = null;
        private void radioButton_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rb = sender as RadioButton ;
            if (rb.Checked)
            {
                selectedItem = rb.Text;
            }
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器