vb.net - Adding file path to listbox item -
I am trying to store the file path in the tag of a list item.
I have added the ListBox1.Tag = sDir line to the first
above. And when I step above the code, the value of
sDir catches the path, but if I make a simple
double click The message path in which the message box pops up only shows the first folder name in the list.
Any tips or advice - I basically want to select a list box item and point it on my path!
Thank you.
each. For in the system In form of. Directory Gate Directories ("c: \ Working") New System in the form of DIARIFFoni Io Dayrectoriinfo (DIR) System.IO.Directory.GetDirectories string as each Sdiair (dirInfo.ToString) dim as the new system sdirInfo.IO.DirectoryInfo (sDir) ListBox1.Items.Add (sdirInfo.Name) ListBox1.Tag = sDir can next store objects as objects, so a small class to store item information:
public class myClass public property filename string public property pathname Rs. The string is invalid as a whole class as public Fu w / o file path: Public Sub New (fName as string, pName as string) FileName = FNamePathName = pName End Sub 'This Suchibak file name The reason for showing in the public override function ToString () as the string return filename ending sub-end class Now you can load them as listboxes in them:
MyClass In the form of 'Loop to post dim L' list: L = new MyClass (filename, pathname) 'Use name and Dir / file objects Suchiboks 1. ITEM and get it back:
'INDEX_TO_READ is a dummy version of the index that you want to receive' selected item too it will work file = Sitiipi (Listblok 1. Aitems (Indeksoooaaadiaadiad, Maiklas) Kfailnam this path = Sitiipi (Listblok 1. Aitems (Indeksacooaaaadi), Maiklas) Kpathanam or in as dim Fhail myClass = Sitiipi (Listblok 1. ITEMS (INDEXOGOAOAAADAD, MA Class)
Comments
Post a Comment