473,465 Members | 2,123 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Shorten Path name

Is there any framework function or code floating
around that someone knows of, that can take a long
path name and remove the middle parts to make it
fit in a given field of characters for display in my UI?

Thanks,

--
Tony M.
Nov 17 '05 #1
4 3253
PathCompactPath[Ex] Win32 Api does this thing.

HTH
rawCoder

"Tony Maresca" <to**@whereever.com> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
Is there any framework function or code floating
around that someone knows of, that can take a long
path name and remove the middle parts to make it
fit in a given field of characters for display in my UI?

Thanks,

--
Tony M.

Nov 17 '05 #2
Not sure exactly what you mean, but if you wanted - say...

C:\SomeFolder\SubFolderOne\SubSubFolderOne\File.tx t

to appear as:

C:\SomeFolder\...File.txt

You could use the string objects methods to concatinate the Left N
characters with "..." and the Right N characters.

There could be several ways to do this, but mostly it comes down to
simple string manipulation.

Nov 17 '05 #3
"Tony Maresca" <to**@whereever.com> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
Is there any framework function or code floating
around that someone knows of, that can take a long
path name and remove the middle parts to make it
fit in a given field of characters for display in my UI?


If you're just worried about displaying the shortened string (i.e. you don't
need to actually know which characters have been removed) then you could try
Graphics.DrawString, using a StringFormat object whose Trimming property is
set to StringTrimming.EllipsisPath.

Chris Jobson
Nov 17 '05 #4
Thanks to all for the advice.

--
Tony M.
"Tony Maresca" <to**@whereever.com> wrote in message news:u2**************@TK2MSFTNGP09.phx.gbl...
Is there any framework function or code floating
around that someone knows of, that can take a long
path name and remove the middle parts to make it
fit in a given field of characters for display in my UI?

Thanks,

--
Tony M.
Nov 17 '05 #5

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

Similar topics

9
by: Bengt dePaulis | last post by:
I have a local directory that I want to include in my sys.path How to save it permanently? Regards /Bengt
2
by: Steven Burn | last post by:
Oks, I know I'm going to seem completely stupid here but, I have a question thats been doing my head in for the last few hours. Basically, I'm trying to find a way to turn a folder and file path,...
8
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web...
70
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
34
by: Reinhold Birkenfeld | last post by:
Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. It still can be found in CVS:...
3
by: UKuser | last post by:
Hi, Is there a way to shorten this line if ((ereg(".jpg",$filename))||(ereg(".eps",$filename))||(ereg(".tif", $filename))||(ereg(".tiff",$filename))||(ereg(".jpeg",$filename))||...
5
by: Dean | last post by:
Hi, I have a table with non-unique identifiers. I need to take all the values with the same ID's and combine them into one field with a semicolon as a seperator. These values may exceed 255...
8
by: moondaddy | last post by:
I'm posting code for a user control ( FunctionConnectorSelector) below which has 3 content controls in it. each content control uses a style from a resource dictionary merged into the app.xaml...
1
by: treeguy | last post by:
I am not a developer but my site has long URL strings that have problem getting crawled. I understand Google now will crawl past the + but does not like the long strings. I tried URL rewrite and it...
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
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...
1
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...
0
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: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 ...

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.