PC Review


Reply
Thread Tools Rate Thread

How to derive the path of a filename without the filename

 
 
Shadowboxer
Guest
Posts: n/a
 
      18th Sep 2003
Hi there!

I seem to have stumbled on to something that I just cant remember how to
do, I could do it in vb6.

I need to get this result

C:\x\y\z\

from the string:
C:\x\y\z\abc.123


any ideas?

THANKS! -S


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      18th Sep 2003
Hello,

"Shadowboxer" <(E-Mail Removed)> schrieb:
> I need to get this result
>
> C:\x\y\z\
>
> from the string:
> C:\x\y\z\abc.123


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

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      18th Sep 2003
"Shadowboxer" <(E-Mail Removed)> schrieb
> I seem to have stumbled on to something that I just cant remember
> how to
> do, I could do it in vb6.
>
> I need to get this result
>
> C:\x\y\z\
>
> from the string:
> C:\x\y\z\abc.123



System.IO.Path.GetDirectoryName


--
Armin

 
Reply With Quote
 
Mattias Sjögren
Guest
Posts: n/a
 
      18th Sep 2003
> I need to get this result
>
> C:\x\y\z\
>
> from the string:
> C:\x\y\z\abc.123
>
>
>any ideas?



System.IO.Path.GetDirectoryName()



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
 
Reply With Quote
 
Shadowboxer
Guest
Posts: n/a
 
      18th Sep 2003
cool! thanks
"Herfried K. Wagner [MVP]" <(E-Mail Removed)> wrote in message
news:utX2r$(E-Mail Removed)...
> Hello,
>
> "Shadowboxer" <(E-Mail Removed)> schrieb:
> > I need to get this result
> >
> > C:\x\y\z\
> >
> > from the string:
> > C:\x\y\z\abc.123

>
> Have a look at 'System.IO.Path.GetDirectoryName'.
>
> --
> Herfried K. Wagner
> MVP · VB Classic, VB.NET
> http://www.mvps.org/dotnet
>
>



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      19th Sep 2003
Hi Shadowboxer,
When you not want to do some IO just use Split or Lastindexof
Cor


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      19th Sep 2003
Hello,

"Cor" <(E-Mail Removed)> schrieb:
> When you not want to do some IO just use Split
> or Lastindexof


Using 'System.IO.Path.GetDirectoryName' doesn't perform any IO operations.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      19th Sep 2003
Ok Ok , mistinking of me, but only for you and not for the OP

When you do not want to use import system.io

I was just telling the alternative.

Cor


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      19th Sep 2003
Hello,

"Cor" <(E-Mail Removed)> schrieb:
> Ok Ok , mistinking of me, but only for you and not for
> the OP
>
> When you do not want to use import system.io
>
> I was just telling the alternative.


No problem. I think it's good that you tell the people about alternative
methods, so they get familiar with the string functions.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Mattias Sjögren
Guest
Posts: n/a
 
      20th Sep 2003

>When you do not want to use import system.io


Why would you not want to do that?



Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HttpPostedFile.saveas(filename) issue when the filename is used "-" as a part of the filename. Ken Microsoft Dot NET Framework 0 25th Feb 2009 10:58 PM
Getting just filename from FileDialog.FileName without path =?Utf-8?B?QW5kcmVzIFJvbWVybw==?= Microsoft C# .NET 1 13th Jul 2005 06:29 PM
Insert > Autotext is missing "filename" and "filename and path"; how to get back? StargateFan Microsoft Word New Users 7 7th Feb 2005 12:17 AM
Default File Path in Workbooks.Open(FileName:="Filename") =?Utf-8?B?RGVubmlz?= Microsoft Excel Misc 1 18th Oct 2004 04:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:33 PM.