Syntax question for C#.If you want to add a number (variable converted to string) to each item in the foreach statement about the list box, .Insert does not seem to work.What's wrong?Is there any other good way?(*I would like to attach it to one item, so it is not .Add.)
foreach (string item in names)
{
NameList.Items.Insert(number);
}
This should simply be accessed as an array.
int fruits=10;
int listcount = NameList.Items.Count;
intquotient=fruits/listcount;
for (inti=0;i<listcount;i++)
{
NameList.Items[i]+=":"+quotient.ToString();
}
© 2024 OneMinuteCode. All rights reserved.