请一些人告诉我如何从列表框控件中删除当前的 SelectedIndex 项。
这是我的代码:.................................................. ..................................................... ..................................................... ...
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
listBox1.Items.Add("www.google.com");
listBox1.Items.Add("www.facebook.com");
listBox1.Items.Add("www.yahoo.com");
listBox1.SelectedIndex = 0;
listBox1.DataSource = listBox1.Items;
}
private void button1_Click(object sender, EventArgs e)
{
var num = listBox1.Items.Count;
string str = Convert.ToString(num);
textBox1.Text = str;
for (int i = 0; i < num; )
{
webBrowser1.Navigate(listBox1.SelectedItem.ToString());
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
{
//what do i do to remove current SelectedIndex item from Listbox control.
}
}
}
}
}