473,472 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FileOpenDialog without a File

My user interface needs to allow the user to select a default directory. When
I say the following:

if (openFileDialog1.ShowDialog() == DialogResult.OK)
{ //record path }

The problem here is that the user gets an error that the file is not valid.
Is there a way to suppress the file-invalid error message?

Thanks,
--
Randy
Oct 5 '06 #1
2 1872
Nik
Why not use a FolderBrowserDialog ?

"randy1200" <ra*******@newsgroups.nospamwrote in message
news:CF**********************************@microsof t.com...
My user interface needs to allow the user to select a default directory.
When
I say the following:

if (openFileDialog1.ShowDialog() == DialogResult.OK)
{ //record path }

The problem here is that the user gets an error that the file is not
valid.
Is there a way to suppress the file-invalid error message?

Thanks,
--
Randy

Oct 5 '06 #2
Yes, Randy,

You can use FolderBrowserDialog to get a folder instead of a file. The
usage is the same as FileDialog. When returned use
FolderBrowserDialog.SelectedPath to get the path.

For more information, please check the following link:

http://msdn2.microsoft.com/en-us/lib...folderbrowserd
ialog.aspx

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Oct 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: reddy | last post by:
I am trying to insert a node into an XMLFile. using XMLTextwriter. My Question is Is it possible to do without using XMLDocument. Because its loading all the the file into memory. I just want to...
1
by: a_rybicki | last post by:
"Hi - I'm experiencing something strange when I call a FileOpenDialog from a dialog box in my application (Borland C++ 6). Basically, here's the scenario: - Open my own child dialog from the...
8
by: Francisco | last post by:
Hi, How can I use a MS-Access DB in a computer without Access installed? I read something about a "runtime" utility, but I don't know how to use it. Any help? Thanks
3
by: gregma | last post by:
I hope this hasn't been covered a million times!! I have searched for alternatives to selecting a directory or multiple directories using FileOpenDialog, and haven't found anything like I need. I...
1
by: Anita C | last post by:
I am trying to follow the Ms sample in the .Net SDK/Technologies/Interop/PlatformInvoke/WinAPIs/CS- to click on a button on a webform to bring up the fileopendialog. But it does not seem to work...
11
by: ulyses | last post by:
Let's assume I have following file: 2938929384902491233..... 923949919199191919112.... File contains INTs only. What is more they are huge. For example first row in file may contain integer...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
2
by: Peted | last post by:
Hi is there a way to use the fileopen dialog in c# 2008, so that when i am traversing a directory to find a file to open, if i click on a shortcut to a file or a shortcut to a directory, it will...
0
by: shamshujjuhah | last post by:
I am using the following code to open file. Now I want to position the fileopen dialog to the centre of screen. Can someone tell me how can I acheive this? code: -------------- OpenFileDialog...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
1
isladogs
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
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.