问题描述
受保护的无效btndelvoters_Click(对象发送者,EventArgs e)
{
试试
{
for(int i = 0; i< listboxvotersemail.Items.Count; i ++)
{
:laugh:如果(listboxvotersemail.SelectedItem.Selected == true)
{
Vote.deletevoters(UserId,binid,listboxvotersemail.SelectedItem.Text);
Vote.deleteUserEmail(UserId,listboxvotersemail.SelectedItem.Text);
}
}
}
赶上
{
}
}
protected void btndelvoters_Click(object sender, EventArgs e)
{
try
{
for (int i= 0; i < listboxvotersemail.Items.Count; i++)
{
:laugh: if (listboxvotersemail.SelectedItem.Selected==true)
{
Vote.deletevoters(UserId, binid, listboxvotersemail.SelectedItem.Text);
Vote.deleteUserEmail(UserId, listboxvotersemail.SelectedItem.Text);
}
}
}
catch
{
}
}
推荐答案
for (int i = 0; i < listboxvotersemail.Items.Count; i++)
{
:laugh: if (listboxvotersemail.Items[i].Selected == true)
{
Vote.deletevoters(UserId, binid, listboxvotersemail.SelectedItem.Text);
Vote.deleteUserEmail(UserId, listboxvotersemail.SelectedItem.Text);
}
}
谢谢,
Imdadhusen
Thanks,
Imdadhusen
foreach (MyObject item in listBox.SelectedItems)
{
// do soemthing with the item
}
这篇关于如何从列表框中查找被选中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!