Listview text problem

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jan 2008
Posts: 20
Reputation: saurabh.verma is an unknown quantity at this point 
Solved Threads: 0
saurabh.verma saurabh.verma is offline Offline
Newbie Poster

Listview text problem

 
0
  #1
Apr 28th, 2008
hi,

i am basically adding files to my listview through this code
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. For each n as string in my.computer.filesystem.getdirectories("C:\Testing\")
  2. Listview1.items.add(n,Imagelist1.images.count - 1)
  3. Next
so all the files inside testing folder show up on the listview
the problem is that they all show up but they show up with the path such as instead of showing test.txt, they would show C:\Testing\test.txt
can anyone please tell me how to only show the filename and not the whole path

any help will be appreciated
Last edited by saurabh.verma; Apr 28th, 2008 at 7:10 pm.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 520
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 89
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Listview text problem

 
0
  #2
Apr 28th, 2008
Hi
This is VB.NET code, I think so.
Try
 
For each n as string in my.computer.filesystem.getdirectories("C:\Testing\")
n.Replace ( "C:\Testing\", "" )
Listview1.items.add(n,Imagelist1.images.count - 1)
Next
I Dont know whether it is right or wrong. Please try it
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 20
Reputation: saurabh.verma is an unknown quantity at this point 
Solved Threads: 0
saurabh.verma saurabh.verma is offline Offline
Newbie Poster

Re: Listview text problem

 
0
  #3
Apr 29th, 2008
No, it wont work it would still show the whole address
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Listview text problem

 
0
  #4
Apr 29th, 2008
if this thread for .net please post in vb.net section.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 520
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 89
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Listview text problem

 
0
  #5
Apr 29th, 2008
Originally Posted by saurabh.verma View Post
No, it wont work it would still show the whole address
Try This
Dim NewString as String 

For each n as string in my.computer.filesystem.getdirectories("C:\Testing\")
   NewString = n.Replace ( "C:\Testing\", "" )
   Listview1.items.add(NewString,Imagelist1.images.count - 1)
Next

I Think Strings are Immutable
Selva
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 20
Reputation: saurabh.verma is an unknown quantity at this point 
Solved Threads: 0
saurabh.verma saurabh.verma is offline Offline
Newbie Poster

Re: Listview text problem

 
0
  #6
Apr 30th, 2008
Thanks a lot, selvaganapathy, it worked.

I really appreciate it
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC