473,722 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Working with customized OpenFileDialog

68 New Member

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 2175

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

Similar topics

by: bobrad | last post by:
MAYBE SOMEBODY CAM HELP I AM USING THE FOLLOWING CODE TO GET A LOCATION OF A FILE IN A WINFORM DIALOG OpenFileDialog openFileDialog = new OpenFileDialog(); OpenFileDialog.Filter = " Access (*.mdb)|*.mdb|All files (*.*)|*.*"; if (openFileDialog.ShowDialog() == DialogResult.OK) DataBaseLocation.Text = openFileDialog.FileName;
by: don | last post by:
has anyone experienced problems with interactions between OpenFileDialog and FileStream? When I select "open" from an OpenFileDialog the subsequent calls to FileStream do not create a file. If I do anything else, eg, navigate to other folders, and then press "cancel" the file is created. This occurrs just with the simple code below. Any ideas private void button1_Click(object sender, System.EventArgs e // open the common dialog bo...
by: Nagachandra Sekhar Grandhi | last post by:
I am facing a problem with OpenFileDialog. It is as follows. I opened OpenFileDialog dialog box and selected a folder in it. After selecting the folder when i tried to delete the same folder in Explorer i am getting error saying that cannot delete that folder as some process is using it. After that i selected a file from the same folder in OpenFileDialog. When i tried to delete the folder after selecting the file also it is giving the...
by: e-mid | last post by:
why does not openFileDialog have closed event? i want to do something; as soon as the dialog closes. is there a way to do this?
by: Gary Nastrasio | last post by:
I'm using the OpenFileDialog class in my application and this changes my current working directory (cwd) when a user selects a file to open. Using MC++, how can I store my cwd into a String and then restore it after the call to OpenFileDialog? Thanks, Gary
by: Greg | last post by:
I'm a bit confused by this - when I set the InitialDiretory of an OpenFileDialog to be a subfolder within the same folder as the app, the file dialog does not initially display the folder - instead it shows the last used folder (this persists after closing the app). However, if I use a different path (e.g. "C:\\") then every time the dialog is shown, it starts at the correct directory every time. Is there something special about an...
by: marcus.kwok | last post by:
I am having a weird problem and I have can't figure out why it is happening. I create an OpenFileDialog and set a filename filter. When the dialog first opens, the filter works correctly, and only the files I want to see appear in the file list box. When I change the filter to one of the other filters, all the files in the list disappear. If I then manually type a filter into the "Filename" textbox, then the files appear and the filter...
by: Martijn Mulder | last post by:
It strikes me that System.Windows.Forms.OpenFileDialog seems te 'remember' which directory it was in last, even when a new OpenFileDialog-object is created for every access to the file system. This 'persistence' also holds between different invocations of the same program. Even when the .cs file is re-compiled, the OpenFileDialog again opens in the directory where it was directed to the previous time. 1. Is this a 'feature' of...
by: sdanda | last post by:
Hai, I am working on vb.net windows application. In my application(Sample) I created some forms.In one form I am using controls OpenFileDialog, a button called as Browse and a textbox control.If I click on Browse button it opens a openfiledialog,now i am selecting a file from that dilog and prints that file name in a textbox. Upto here everything works fine..but whats the problem the current working direcory is changed. That is If I run my...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.