注册 登录
编程论坛 新人交流区

关于怎么样读取Checkbox选中的值

firehood 发布于 2007-10-17 22:22, 378 次点击

C#起步者问一个弱弱的问题,望大虾指导。
问题描述: 对于一组Checkbox,当它被选中时,我希望在一个输出框中能输出Checkbox的的Text属性的描述。
我的方法如下:自己胡乱写的,运行有错误,请大虾指点一下。
string output;
if (this.cbad.Checked)
{
output = "+this.cbad.Text+";
}
if (this.cben.Checked)
{
output += this.cben.Text;
}
if (this.cbex.Checked)
{
output += this.cbex.Text;

}
if (this.cbst.Checked)
{
output += this.cbst.Text;

}
this.txoutput.Text = output;

2 回复
#2
firehood2007-10-17 22:27
求助!!
#3
liwanlei2007-10-17 22:34
af s
1