473,698 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extracting filename

Hi

I am using openfiledialog to get user to select files and then I am
extracting the files using filenames(). How can I now separate the file path
from the actual filename?

Thanks

Regards
Nov 20 '05 #1
10 2289
* "John" <jo**@nospam.in fovis.co.uk> scripsit:
I am using openfiledialog to get user to select files and then I am
extracting the files using filenames(). How can I now separate the file path
from the actual filename?


Have a look at 'System.IO.Path .GetFileName'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Hi John,

Or you could wonder about the usefulness of:
sFilePath.LastI ndexOf ("\")

Regards,
Fergus
Nov 20 '05 #3
* "Fergus Cooney" <fi******@tesco .net> scripsit:
Or you could wonder about the usefulness of:
sFilePath.LastI ndexOf ("\")


Are you sure every platform uses "\" as path separator?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Hi Herfried,

There's only one that matters. ;-)

No, I'm just pointing out LastIndexOf(). I leave it to John to decide what
characters to check for.

Regards,
Fergus
Nov 20 '05 #5
* "Fergus Cooney" <fi******@tesco .net> scripsit:
There's only one that matters. ;-)


On Windows systems. If the framework is ported to an other platform,
there may be other separators, for example "/".

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
Hi Herfried,

!! There's only one that matters. ;-)
^
^ This bit's the joke that says there's <only Windows>.

!! No,
^
^ This bit tells you that I'm aware of other systems.

!! I leave it to John to decide what characters to check for.
^
^ This bit says it's John's problem (or not - he knows where he's at).

Regards,
Fergus

Nov 20 '05 #7
In article <bm************ @ID-208219.news.uni-berlin.de>, Herfried K. Wagner [MVP] wrote:
* "Fergus Cooney" <fi******@tesco .net> scripsit:
Or you could wonder about the usefulness of:
sFilePath.LastI ndexOf ("\")


Are you sure every platform uses "\" as path separator?


You could always check System.IO.Path. PathSepartor to find out :)
--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #8
Tom,
Actually Path.PathSepara tor is a semi colon, as its the character that
separates a list of paths.

You are thinking Path.AltDirecto rySeparatorChar &
Path.DirectoryS eparatorChar, which separates a directory in a path.

And don't forget about Path.VolumeSepa ratorChar which is the colon between
the drive letter & the rest of the path.

Plus there is Path.InvalidPat hChars for characters we should not be using in
paths.

Hope this helps
Jay

"Tom Shelton" <to*@mtogden.co m> wrote in message
news:eD******** ******@TK2MSFTN GP12.phx.gbl...
In article <bm************ @ID-208219.news.uni-berlin.de>, Herfried K.

Wagner [MVP] wrote:
* "Fergus Cooney" <fi******@tesco .net> scripsit:
Or you could wonder about the usefulness of:
sFilePath.LastI ndexOf ("\")


Are you sure every platform uses "\" as path separator?


You could always check System.IO.Path. PathSepartor to find out :)
--
Tom Shelton
MVP [Visual Basic]

Nov 20 '05 #9
On 2003-10-15, Jay B. Harlow [MVP - Outlook] <Ja********@ema il.msn.com> wrote:
Tom,
Actually Path.PathSepara tor is a semi colon, as its the character that
separates a list of paths.

You are thinking Path.AltDirecto rySeparatorChar &
Path.DirectoryS eparatorChar, which separates a directory in a path.

And don't forget about Path.VolumeSepa ratorChar which is the colon between
the drive letter & the rest of the path.

Plus there is Path.InvalidPat hChars for characters we should not be using in
paths.

Hope this helps
Jay


Jay,

You are of course correct! I posted in haste, as usual :)

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #10

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

Similar topics

4
3114
by: Davor Cengija | last post by:
I need to write a script which should extract the attachment from a text file, which is saved as MIME mail message. Unfortunatelly, Message.is_multipart() returns False so msg.get_payload() returns the complete message. What I need is the attachment only. Is it possible to do that with standard email package without the actual string level parsing? This is how my file/message looks like: ====== start here ======== This is a multi-part...
2
2532
by: Avi | last post by:
hi, Can anyone tell me what the problem is and how to solve it The following piece of code resides on an asp page on the server and is used to download files from the server to the machine accessing the abobe mentioned asp page. It WORKS for every type of file when I change the content type according to the file type, but it won't work with self extracting files. When an end user downloads a self extracting file by accessing the...
13
3726
by: PS | last post by:
I want to display the image from database to picture box through ado.net and vb.net I have some images present in a sql server 2000 table stored under 'image' datatype. I want to extract and display them in a picture box present in a vb.net form I appreciate any help on this Thanks PS
3
2653
by: War Eagle | last post by:
I've been looking at .substring and .trim methods and I still have a question about extracting substrings from a textbox. Basically the textbox contains the full path to a file ... for example C:\testfile.txt or ... C:\download\temp\dlls\testfile.dll I want to be able to extract the file name from this textbox (and put it in a string) when I click a button. Can someone illustrate how to write this line of code?
0
3722
by: Nadav | last post by:
Hi, Introduction: *************************** I am using the MSI API to extract MSI embedded files, I do this by iterating through all of the records in the ‘_Streams’ table and dumping each to a local directory on the disk, the following illustrate this: 01)MsiDatabaseOpenView(m_hMSI, L"SELECT `Name`,`Data` FROM `_Streams`", &hStreamsView)
2
2813
by: Dickyb | last post by:
Extracting an Icon and Placing It On The Desktop (C# Language) I constructed a suite of programs in C++ several years ago that handle my financial portfolio, and now I have converted them to C#. The only significant problem that I have encountered in the conversion is this one - extracting an icon from the 'KTEntryPoint' program into the software suite and placing that icon on the PC Desktop.
4
5967
by: Ravi | last post by:
Iam trying to open an self extracting zip file from my windows application. it opens an command window and does not do any thing afterwards. here is the code iam doing it. System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = filename; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.UseShellExecute = false;
6
4921
by: rlntemp-gng | last post by:
I need to extract information from some Excel files but am stuck with part of it: As an example, I have the following Excel File that has 3 tabbed sheets: FileName: C:\ExcelData\JulyFile1.xls SheetName: Sheet1-07032007 RowCount: 325 ColumnCount: 15 SheetName: Sheet2-07102007 RowCount: 450 ColumnCount: 25 SheetName: Sheet3-07172007 RowCount: 625 ColumnCount: 45 (I have 7 other Excel files with similar attributes)
4
3880
by: dexter48 | last post by:
Hi I'm searching for a string occurance in a text file. I find the string ok and write the results to a log file. But on the line above is also some information I need. How can i get that. The string occurs a number of times, but not an exact match for the string above. Can you help please: see code #!C:\\Perl\\bin use File::Copy; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); ...
0
8674
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9028
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 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...
1
8895
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,...
0
7728
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
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 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...
0
4369
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3046
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
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.