Hello there,
We've created a mini search engine that browses through folders on the computer.We're using windows form in C# to code.The user enters their desired searches into combo boxes and text boxes.Then the files in that particular folder will show up on a list and the user will be able to open that file from the list box.The problem is when the program is first executed an item is automatically selected from the list box and that file opens.I dont want any files opening untill I actually click on an item but in this program one of the files automatically opens.Below is my code,I've tried using listBox1.ClearSelected() to unselect any selected items but that didnt work either.Does anyone have any ideas?
Thanks in advanced!
private void search_Click(object sender, EventArgs e) //the search button
{
string path1 = @"C:\svn\DSBCA_PROGRAM\" + idariteknik.SelectedItem.ToString()
+ "\\" + modccb.SelectedItem.ToString() + "\\"
+ searchboxLRU.SelectedItem.ToString()
+ "\\" + txtparca.Text;
listBox1.DataSource = System.IO.Directory.GetFiles(path1);
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Process.Start(listBox1.SelectedItem.ToString());
}
}
We solved that problem. We changed code like this:
private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { Process.Start(listBox1.SelectedItem.ToString()); }