December 2001
Intermediate to advanced
416 pages
8h 16m
English
Nobody really wants to type in a file name, let alone a file name and path. What users want is a directory tree dialog window to pop up that they can navigate and select from. The first step, as always, is to drag the control onto the form. Unlike the other controls so far, OpenFileDialog is not a visible control. It does not display in the form. Rather we need to associate it with a visible control. The usual suspect is an Open menu item.
When the user clicks the menu item, we need to respond by invoking the openFileDialog1 object's ShowDialog() member function. The menu item event handler looks like this:
private void menuItem2_Click(object sender, System.EventArgs e) { Text = "Open Menu Item Clicked"; openFileDialog1.ShowDialog(); ...Read now
Unlock full access