my For statement is not highlighting/selecting items from the listbox am missing something?
if (listId.Items.Count != 0 && listCell.Items.Count != 0)
{
for (int a = 0; a < listId.Items.Count; a++)
{
for (int b = 0; b < listCell.Items.Count; b++)
{
MakeReq(txtWebUpdate.Text + listId.Items[a].ToString() +
"&brand=1", listCell.Items[b].ToString());
}
}
}
this is an old vb6 code i dug up that i use to use... what it did was loop through a listbox select one entry at a time and also highlighted/selected visually the entry in the listbox. I want to do something just like that开发者_Go百科 with the C# code above
Do Until lstNames.ListCount = 0
lstNames.ListIndex = 0
GetMoreNames = ""
For b = 1 To 1
GetMoreNames = GetMoreNames & lstNames.Text & ","
lstNames.RemoveItem lstNames.ListIndex
lstNames.ListIndex = lstNames.ListIndex + 1
Next b
I'm assuming the makeReq is redirecting with a querystring value? Need more code to know see what you're trying to accomplish here.
I don't know why you wouldn't just use a simple ListBox1.SelectedItem.Value;
精彩评论