473,469 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

OpenFileDialog.FileName and FolderBrowserDialog.SelectedPath are not the same datatype ???

Hi,

Here is something i can't figure out what i am doing wrong:

I use a OpenFileDialog to select a file. I put the result string from
the FileName property in a textbox on my form. Later on I save the
..Text property to an xml file. Nothing happens, the filename is not
writen to the xml file, and there is no exception.

When I replace the OpenFileDialog with a FolderBrowserDialog and I
copy the SelectedPath string to the textbox, and save it to the xml
file everything works fine.

Is there a difference between the both? They should both be a string.
When I debug the application I can see them both apear as string
literals.

I you can help me out on this one that would be great!

regards,

David
Nov 16 '05 #1
2 6703
David,

I don't think that it has to do with the dialog that you use. You said
that you store the value in a textbox, and then to an XML file. If you see
the value in the textbox, then assuming the code to save to the XML is
right, everything should be fine.

Of course, it's hard to tell without seeing any of your code. Can you
give an example?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Koala Beer" <ko********@msn.com> wrote in message
news:fb**************************@posting.google.c om...
Hi,

Here is something i can't figure out what i am doing wrong:

I use a OpenFileDialog to select a file. I put the result string from
the FileName property in a textbox on my form. Later on I save the
.Text property to an xml file. Nothing happens, the filename is not
writen to the xml file, and there is no exception.

When I replace the OpenFileDialog with a FolderBrowserDialog and I
copy the SelectedPath string to the textbox, and save it to the xml
file everything works fine.

Is there a difference between the both? They should both be a string.
When I debug the application I can see them both apear as string
literals.

I you can help me out on this one that would be great!

regards,

David

Nov 16 '05 #2
Nicholas,

You are right, it has got nothing to do with the dialogs.

I was writing a small test to prove my point, and when I run it for
the first time I also found out what I was doing wrong.

I didn't realise that when using the filedialog the default directory
is also changing, so when I write the xml, is ends up in the wrong
directory. When I read back the xml from the home directory of my
application it looks as if nothing has been written.

How stupid can one be!

Anyway, thanks for your reaction and for getting me to write the test
program.

regards,

David

On Mon, 21 Jun 2004 10:09:47 -0400, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.com> wrote:
David,

I don't think that it has to do with the dialog that you use. You said
that you store the value in a textbox, and then to an XML file. If you see
the value in the textbox, then assuming the code to save to the XML is
right, everything should be fine.

Of course, it's hard to tell without seeing any of your code. Can you
give an example?


Nov 16 '05 #3

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

Similar topics

2
by: Koala Beer | last post by:
Hi, Here is something I can't figure out what I am doing wrong: I use a OpenFileDialog to select a file. I put the result string from the FileName property in a textbox on my form. Later on I...
3
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...
0
by: Derrick | last post by:
If I have code... FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.RootFolder = Environment.SpecialFolder.MyComputer; fbd.SelectedPath = "C:\\Documents and Settings\\theCurrentUser"...
4
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...
1
by: alf | last post by:
Hi, I am using a FolderBrowserDialog to allow the user to select a folder as follows: FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog(); folderBrowserDialog1.RootFolder =...
1
by: Ido Flatow | last post by:
Here's the scenario: - Created a web service project - Added 2 services (asmx files) - Created a custom entity ("Customer") - Created a method in each service which returns/receives the above...
3
by: antuantuan | last post by:
Hi. How can I initialize a FolderBrowserDialog choosing a particular RootFolder? I saw that FolderBrowserDialog has a RootFolder member, but it accepts only an Environment.SpecialFolder (but I...
6
by: chrisknapp | last post by:
I'm learning VB and am making an application where I need a user to be able to choose which folder his files are located in. The folder path chosen will be stored as a string for later use in the...
6
by: SpreadTooThin | last post by:
After I select a file with the OpenFileDialog, I get the file name with .FileName, but I want to know the drive and path where that file is. What function, method, class can I use in C# to get the...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.