for (int xx = 0; xx < piCount; xx++)
{
comboBox1.Items.Add(xx);
}
piCount is int. And the value of it is 8. If i'm starting from 0 i will see in the comboBox 01234567 But i want to see 12345678
Just change your loop:
for (int xx = 1; xx <= piCount; xx++)
{
comboBox1.Items.Add(xx);
}
Notice how the upper limit comparison is changed form <
to <=
.
You can also keep your loop and add 1 in the body:
for (int xx = 0; xx < piCount; xx++)
{
comboBox1.Items.Add(xx + 1);
}
Change counters like this
for (int xx = 1; xx <= piCount; xx++)
{
comboBox1.Items.Add(xx);
}
Now this starts from 1 and goes to so on upto the piCount.
将循环更改为:
for (int xx = 1; xx <= piCount; xx++)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.