簡單問題﹐真不知怎么搞的。。。

Keyln 2003-03-08 08:48:56
winform上。有checkBox1,checkBox2,checkBox3
for(i=0;i<4;i++)
{
//如何行到選中的checkbox的值
}
這几天開始學c#﹐總是感覺很。。
...全文
17 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lkal4587 2003-03-08
  • 打赏
  • 举报
回复
我晕~

你需要复习一下“事件驱动”
Keyln 2003-03-08
  • 打赏
  • 举报
回复
cb=new TextBox[10];
int x=1;
for (int i=1;i<10;i++)
{
x=x+20;
cb[i]=new TextBox();
this.Controls.Add(cb[i]);
this.cb[i].Top =x;
this.cb[i].Text =i+"kddddd";
MessageBox.Show (this.cb[i].Text.ToString (),"kdfjd");
}
換個text試試后才知。。原來1太小了。。
Keyln 2003-03-08
  • 打赏
  • 举报
回复
cb=new CheckBox[10];
for (int i=1;i<10;i++)
{
cb[i]=new CheckBox();
this.Controls.Add(cb[i]);
this.cb[i].Location = new System.Drawing.Point(i+10, 33);
this.cb[i].Text =i+"kddddd";
MessageBox.Show (this.cb[i].Text.ToString (),"kdfjd");
}
控件已生成﹐但位置不會改變﹐代碼哪里有問題??
Keyln 2003-03-08
  • 打赏
  • 举报
回复
怎么沒有答一下呀。。
ismezy2002 2003-03-08
  • 打赏
  • 举报
回复
不能用循环,因为不是数组
应该直接用checkBox1.Text、checkBox2.Text、checkBox3.Text

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧