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#