Click here to Skip to main content
15,881,380 members
Home / Discussions / C#
   

C#

 
GeneralRe: Desposing Form problem Pin
Martin#17-Apr-07 20:07
Martin#17-Apr-07 20:07 
GeneralRe: Desposing Form problem Pin
EEmaan17-Apr-07 20:13
EEmaan17-Apr-07 20:13 
GeneralRe: Desposing Form problem Pin
Martin#17-Apr-07 20:22
Martin#17-Apr-07 20:22 
GeneralRe: Desposing Form problem Pin
Christian Graus17-Apr-07 20:38
protectorChristian Graus17-Apr-07 20:38 
GeneralRe: Desposing Form problem Pin
Martin#17-Apr-07 20:43
Martin#17-Apr-07 20:43 
QuestionSplitting a path... Pin
deridder14917-Apr-07 17:28
deridder14917-Apr-07 17:28 
AnswerRe: Splitting a path... Pin
rah_sin17-Apr-07 17:53
professionalrah_sin17-Apr-07 17:53 
GeneralRe: Splitting a path... [modified] Pin
Mark Greenwood17-Apr-07 17:57
Mark Greenwood17-Apr-07 17:57 
Much easier

add

using System.IO;

to the top of your file

Then you can use

<br />
string strFile = @"c:\file\file.txt";<br />
string strTemp = Path.GetFileName(strFile); // GIves File.txt<br />
strTemp = Path.GetDirectoryName(strFile); // Gives c:\file<br />
strTemp = Path.GetPathRoot(strFile); // Gives c:\<br />


Problem with the earlier suggestion is that it won't help with more than a single directory - you can't gaurantee that item 3 in the array will be the filename every time, because one more layer such as

c:\somedir\somsubdir\somefile.txt

will force the filename into the 4th spot - at least using Path functions you can always get the Drive, Actual Directory and Actual file....

After that you can put them into an array

Mark.


-- modified at 0:03 Wednesday 18th April, 2007
GeneralRe: Splitting a path... Pin
Christian Graus17-Apr-07 19:30
protectorChristian Graus17-Apr-07 19:30 
AnswerRe: Splitting a path... Pin
AB777117-Apr-07 18:20
AB777117-Apr-07 18:20 
QuestionAdd a Form to TabControl Pin
Dothanhnam17-Apr-07 16:24
Dothanhnam17-Apr-07 16:24 
AnswerRe: Add a Form to TabControl Pin
lchild38517-Apr-07 16:39
lchild38517-Apr-07 16:39 
GeneralRe: Add a Form to TabControl [modified] Pin
Dothanhnam17-Apr-07 17:12
Dothanhnam17-Apr-07 17:12 
AnswerRe: Add a Form to TabControl Pin
Martin#17-Apr-07 20:14
Martin#17-Apr-07 20:14 
GeneralRe: Add a Form to TabControl Pin
Svett17-Apr-07 20:42
Svett17-Apr-07 20:42 
GeneralRe: Add a Form to TabControl Pin
Martin#17-Apr-07 20:45
Martin#17-Apr-07 20:45 
QuestionHow to get parent process id of a process Pin
lchild38517-Apr-07 16:23
lchild38517-Apr-07 16:23 
AnswerRe: How to get parent process id of a process Pin
Dave Kreskowiak17-Apr-07 17:03
mveDave Kreskowiak17-Apr-07 17:03 
GeneralRe: How to get parent process id of a process Pin
lchild38518-Apr-07 2:42
lchild38518-Apr-07 2:42 
QuestionDetect up/down pressed for NumericUpDown class Pin
bankai12317-Apr-07 15:51
bankai12317-Apr-07 15:51 
AnswerRe: Detect up/down pressed for NumericUpDown class Pin
sujithkumarsl17-Apr-07 19:55
sujithkumarsl17-Apr-07 19:55 
GeneralRe: Detect up/down pressed for NumericUpDown class Pin
sivakarthick17-Apr-07 20:26
sivakarthick17-Apr-07 20:26 
QuestionCollection of Objects Pin
sreecahitu17-Apr-07 12:45
sreecahitu17-Apr-07 12:45 
AnswerRe: Collection of Objects Pin
Christian Graus17-Apr-07 13:04
protectorChristian Graus17-Apr-07 13:04 
AnswerRe: Collection of Objects Pin
sujithkumarsl17-Apr-07 19:57
sujithkumarsl17-Apr-07 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.