473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

get only fileName from OpenFileDialog

144 100+
hello,

i find that if i use the OpenFileDialog1.fileName, i get the fullpath + the name of the file selected by the user.

how to get only the filename and its extension but without the path to the file?

Thank you.
Oct 20 '09 #1

✓ answered by tlhintoq

Take a look on the MSDN for System.IO.Path namespace.
It has a lot of methods for .GetFileName() .GetFileNameWithoutExtension() and so on.

http://msdn.microsoft.com/en-us/libr...h_methods.aspx

2 6445
tlhintoq
3,525 Expert 2GB
Take a look on the MSDN for System.IO.Path namespace.
It has a lot of methods for .GetFileName() .GetFileNameWithoutExtension() and so on.

http://msdn.microsoft.com/en-us/libr...h_methods.aspx
Oct 20 '09 #2
thesti
144 100+
hi!,

thanks tlhintoq. i'll give it a try.
Oct 21 '09 #3

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

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...
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...
5
by: jlea | last post by:
I'm trying to pass a filename, obtained with using the fileName property from the OpenFileDialog, as a application parameter in Process.StartInfo.Arguments and run a MFC/C++ application using the...
2
by: Hrcko | last post by:
How can I read just the name of the file? When I put fileName=openFileDialog.FileName I get the full path, but I just want the name of the file. Hrcko
1
by: ad | last post by:
I use the codes below to get the filename of openFileDialog, but it always return a null. How can I get he filename of openFileDialog? ...
5
by: Webbyz | last post by:
Using vb.net Hello. Here is the problem that I am having. I have a program which makes a copy of my working database (wasa.mdb) and saves it to another folder (/bin/backup/) with the filename...
8
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...
5
by: Petrosky | last post by:
Hello, May I ask what built-in functions available out there in C# to search for a particular filename input from the user at runtime ? I am completely new to system thingies, so please help...
6
by: johnlarson | last post by:
I am using an openfiledialoge to open a dbf file in a windows app. the error I get is c:\myfile.dbf not an valid filename. here is my code private void button1_Click ( object sender , EventArgs e...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.