[英]C# Listbox selecting items
my For statement is not highlighting/selecting items from the listbox am missing something? 我的For语句没有突出显示/从列表框中选择项目丢失了什么?
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. 这是一个旧的vb6代码我挖出来,我用它...它做的是循环通过列表框一次选择一个条目,并在视觉上突出显示/选择列表框中的条目。 I want to do something just like that with the C# code above 我想用上面的C#代码做一些事情
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? 我假设makeReq使用查询字符串值重定向? 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; 我不知道为什么你不会只使用一个简单的ListBox1.SelectedItem.Value;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.