Listbox Count error
I'm receiving an error on the 5th line, listCell.Count() tried resolving it with listCell.Items.Count() but that didn't work... any idea? error: does not contain a 开发者_如何学Pythondefinition for count.
int listCellCounter = 0;
for (int x = 0; x < listId.Items.Count; x++)
{
Console.WriteLine("something " + listId.Items[x] + " " + listCell.Items[listCellCounter]);
if (listCellCounter == listCell.Count() - 1)
{
listCellCounter = 0;
}
else
{
listCellCounter += 1;
}
}
Im not quite sure what collection the listCell is but I'd imagine that .Count() should be a property. So try to change your code to this:
...
if (listCellCounter == listCell.Count - 1) // or listCell.Items.Count - 1
{
listCellCounter = 0;
}
...
The error you are getting basicly just means that there is no Count() method in listCell.
精彩评论