469,954 Members | 1,876 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

Working with customized OpenFileDialog


I'm having a problem trying to get a customised OpenFileDialog() to fulfil my requirements.
The code for this custom-built dialog has been taken from another site (http://www.codeproject.com/KB/dialog...gExtender.aspx) ) and allows the user to select the
viewing method before opening the dialog to show a file directory.

The following event is assigned to a button on my form which, when prompted, displays the dialog.

Expand|Select|Wrap|Line Numbers
  1. public void ShowOpenDialog(object sender, System.EventArgs e)
  2. {
  3.     new OpenFileDialog().ShowDialog();
  4. }
There is also an Enum which priovides an option to the user to choose a viewing type (i.e - Icons, Tiles, Thumbnails, List, Details). This enum is driven by a seperate dialogue that is shown to the user as a drop-down list which they must select from before they open the OpenFileDialog(), using the
following method:

Expand|Select|Wrap|Line Numbers
  1. public void SelectedIndexChanged(object sender, System.EventArgs e)
  2. {
  3.     _extender.DialogViewType = (FileDialogExtender.DialogViewTypes)_cmbViewType.SelectedItem;
  4. }
I want to show a thumbnail view and as you might or might not know, the OpenFileDialog does not contain a property to assign this as a default. I am able to get the OpenFileDialog showing Thumbnail view (by not creating an instance of OpenFileDialog) but it will not let me:

a) Do this by default
b) Create an instance of OpenFileDialog and use its properties e.g. .FileName
b) Allow me to assign the name of the file, selected by the user, to an instance variable.

If you could give me guidance with one or any of these issues, that would be appreciated.

If you would like me to show more code, please let me know.

May 5 '09 #1
0 1724

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by bobrad | last post: by
4 posts views Thread by Nagachandra Sekhar Grandhi | last post: by
8 posts views Thread by e-mid | last post: by
2 posts views Thread by Gary Nastrasio | last post: by
3 posts views Thread by Martijn Mulder | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.