Solved

how to set default in intial directory as Desktop in any system using open filedialog control

Posted on 2009-05-14
2
225 Views
Last Modified: 2013-12-17
HI,

In my requirement, in my form one browse button is there. when ever we click the browse button, i need to locate csv files in the Desktop only(means, after that their wish to locate another location) in any system.

But i unable to get bydefault desktop, it always goes Documents.

plz help on this.
thanx.
0
Comment
Question by:BDPL
2 Comments
 
LVL 3

Accepted Solution

by:
csenasa earned 250 total points
ID: 24392756
Hi,

Code in the snippet wil the work for U!!!

  // Create a Dialog Object

            OpenFileDialog dialog = new OpenFileDialog();
 

            // Get the DEsktop folder path....

            dialog.InitialDirectory = Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory).ToString();
 

            // Show dialog!!!!!

            dialog.ShowDialog();

Open in new window

0
 

Author Comment

by:BDPL
ID: 24392832
Hi,

Its working fine.

Thank you very mcuh
bye
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Error - Add Failed 12 78
Copy/Clone an object. 9 29
Server Error 11 47
Handle KeyDown for ToolStripDropDownButton, ToolStripMenuItem 3 18
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now