1

I have a List<string> that contain 5 files for example in index[0] I see:

D:\New folder (45)\converted.avi_Automatic\Lightning 2 Length 4 [276 - 280]\000276.bmp

The line is :

label22.Text = files[_indx].ToString();

I want instead see in label22 : D:\New folder (45)\converted.avi_Automatic\Lightning 2 Length 4 [276 - 280]\000276.bmp to see only: 000276.bmp

Before files were _files wich is a List<FileInfo> so I could make _files[_indx].FullName or .Name

But now the list is List<string>

1
  • If files is a List<string> then you don't need to call .ToString() on files[_indx] as the item at that index is a string anyway. Commented Jan 26, 2013 at 20:49

1 Answer 1

6

You can use the Path.GetFileName method

label22.Text = Path.GetFileName(files[_indx]);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.