[Help] Extract Filename From Listbox[Solved]

Posts 1–8 of 8 · Page 1 of 1
[Help] Extract Filename From Listbox[Solved]
I need help extracting the filename from an item on a listbox
Code:
Ex. C:\Documents and Settings\User\My Documents\Test.txt
i want to extract the "Test.txt" into a second listbox any ideas?
"Extract"?

Listbox2.items.add (Listbox1.Items.indexof(0))

Something like that, amirite?
i tried the code, but all it gave me in return was an integer D:
Yeah it would only return an integer, seeing as all he did was search for the index of an integer, which your ListBox may not even contain.

Try something like this.
[php]
For each lbItem As String in ListBox1.Items
ListBox2.Items.Add(IO.Path.GetFileName(lbItem))
Next
[/php]
Quote Originally Posted by FatCat00 View Post
Thanx Jason /
Not a problem.
Listbox2.Items.Add(ListBox1.Items(0).Substring(Lis tbox1.Items.LastIndexOf("\")))
Mkay solved then
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us