当前位置:编程学习 > C#/ASP.NET >>

Winform中获得多个CheckBox的Tag,Text,并把得到的多个tag,Text之间用逗号分开

Winform窗体中,有多个CheckBox,现在要拿到选中的checkbox的Tag和text,并把拿到的tag和text分别用逗号隔开? CheckBox tag WinForm --------------------编程问答--------------------
ArrayList al = new ArrayList();
        void getCBTagAndText()
        {
            al.Clear();
            foreach (Control c in this.Controls)
            {
                if ((c as CheckBox) != null)
                {
                    if (c.Tag != null)
                        al.Add(c.Tag.ToString() + "," + c.Text);
                    else
                        al.Add("null," + c.Text);
                }
            }
        }
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,