zoukankan      html  css  js  c++  java
  • <原创>获取窗口上RadioButton的Tag值

    private void button2_Click(object sender, EventArgs e)
    {
    CheckRadioButton();
    }
    List<RadioButton> rList = new List<RadioButton>();
    private void CheckRadioButton()
    {
    string str = "";
    foreach (Control rButton in this.Controls)
    {
    if (this.Controls.Count == 0)
    {
    label1.Text = "当前窗体没有控件";
    return;
    }
    if (rButton is RadioButton)
    rList.Add((RadioButton)rButton);
    }
    if (rList.Count == 0)
    str = "当前窗体没有RadioButton控件";
    else
    {
    for (int i = 0; i < rList.Count; i++)
    {
    if (rList[i].Tag == null)
    str += rList[i].Name + "的Tag值为空 ";
    else
    str += rList[i].Name + "的Tag值为" + rList[i].Tag.ToString();
    }
    }
    label1.Text = str;
    }

    转载需声明

    人最宝贵的就是生命,生命对于每个人来说只有一次。人的一生应该这样度过:回首往事,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞愧;临终之际,他能够说:“我的整个生命和全部精力,都献给了世界上最壮丽的事业——为解放全人类而斗争。”
  • 相关阅读:
    视频输入 范例
    视频输出 范例
    开启VI视频输入设备 范例
    初始化MMP系统 范例
    Git 的使用
    DVS/DVR/NVR/XVR
    shell命令中 && 和 || 的区别
    码流 / 码率 / 比特率 / 帧速率 / 分辨率 / 高清
    DNS与DSN
    ob_start()失效与phpunit的非正常结束
  • 原文地址:https://www.cnblogs.com/Imgiser/p/5347134.html
Copyright © 2011-2022 走看看