Using a ComboBox to open a FileDialog
Hello Forum,
I have a question regarding the best way to use a ComboBox for opening a FileDialog.
I am trying to use a ComboBox to display a list of recently open files. The top (1st) item in the list is always 'Open Other File'. My problem is that if there are no recently open files, (meaning that the only item in the list is the 'Open Other File'), the 'SelectionChanged' event will not work due to the selection not been changed. I am unsure what other event to fire that would make the dialog appear.
Any help with this one will be gratefully received.
Kind Regards,
Harold Clements
Kirtan PatelPosted Nov 25, 2009, 9:09 PM
you don't need to find Another Event you can do this By Selection changed event it self
just make one more item in Combo Box that Will Indicate user to select File .. then user have to select one item
like below image and always make 0th item Selected By default so if user not chose any thin then Select Recent File
Option Will be there you can make Combo box to Show By Default Selected Item as 0th by below code .
if my answer helps you then check "Do you like this answer" check box please :)
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.SelectedIndex = 0;
}
if it does not satisfy your requirement then you can use MouseClick Event or Dropdown Close Event :)