winform程序中comboBox控件问题。寝室号: [comboBox控件]寝室号是: 101-149,201-249,.....501-549。
一起五楼。comboBox编辑项可以每行添加一个数,
我想用循环来写,怎样写啊? for (int i = 1; i < 6; i++)
{
for (int j = 1; j < 50; j++)
{
string i1 = Convert.ToString(i);
string j1 = Convert.ToString(j);
if (j < 10)
{
j1 ="0"+j1;
Console.WriteLine(i1 + j1);
}
else
{
Console.WriteLine(i1 + j1);
}
}
}for循环又放到那里呢?
一起五楼。comboBox编辑项可以每行添加一个数,
我想用循环来写,怎样写啊? for (int i = 1; i < 6; i++)
{
for (int j = 1; j < 50; j++)
{
string i1 = Convert.ToString(i);
string j1 = Convert.ToString(j);
if (j < 10)
{
j1 ="0"+j1;
Console.WriteLine(i1 + j1);
}
else
{
Console.WriteLine(i1 + j1);
}
}
}for循环又放到那里呢?
解决方案 »
- 如何用代码读取客户端软件查询出的数据
- 寻找Visual Studio一个颜色插件。
- 如何将DataTable表存入数据库呢?
- 50分求教如何向Excel中插入数据
- C# 如何在VS2005下winform窗体中播放avi视频
- 能在C++中调用的C#组件怎么做?
- sqlconnection.connectionstring 和 oledbconnection.connectionstring
- 有没有办法把dll嵌入exe?
- 请问:使用ftp上传和直接使用上传控件上传的区别是什么啊?
- 异常"未将对象引用设置到对象的实例",怎么办?
- 新手求助:public new 和 new public
- c# 播放MP4视频问题 求代码
{
for (int j = 1; j < 50; j++)
{
string i1 = Convert.ToString(i);
string j1 = j.ToString("00");
if (j < 10)
{
//j1 ="0"+j1;
Console.WriteLine(i1 + j1);
}
else
{
Console.WriteLine(i1 + j1);
}
}
}
for (int i = 1; i < 6; i++)
{
for (int j = 1; j < 50; j++)
{
string i1 = Convert.ToString(i);
string j1 = j.ToString("00");
this.comboBox1.Items.Add(i1+j1);
}
}
循环的代码会,我的意思是,for语句块放在哪个位置?
comboBox控件的那些属性或方法或编辑?
//窗体加载事件
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 1; i < 6; i++)
{
for (int j = 1; j < 50; j++)
{
string i1 = Convert.ToString(i);
string j1 = j.ToString("00");
this.comboBox1.Items.Add(i1+j1);
}
}
}