vb6 - How to give a name to each list item in Visual Basic 6 -
I am creating a music player using list control. I want to change the name of the song in the user's list, but I want some property to include the THAT list item. Please help me in this regard. Any help would be appreciated. Thanks in advance. The Edit A listbox , after adding an item to you, set Code>. Listbox example linking;
private sub AddToList (ByVal as txtFileName string) I dimmed Integer Dim blnFileAlreadyexists Boolean txtFileName = trim (txtFileName) As txtFileName & lt; & Gt; "" Then blnFileAlreadyexists = False i = 0 List1.ListCount - 1, then trim (List1.List (i)) = txtFileName Then blnFileAlreadyexists = not really end next blnFileAlreadyexists then List1.AddItem (txtFileName) List1.ItemData (txtFileName) end if ending end
x.itemdata (x.newindex) to an array (or UDT array) in the index, which contains related data.
Options obvious personal type TFileData OriginalFilePath string ListBoxIndex integer MoreBlaBla string as as "// end any more members of private maFiles in () Private Sub Form_lod as TFileData () // initial Elok redeemed Mafail (0) AddToList "Aaaa" AddToList "BBBB" AddToList "Aaaa" AddToList "CCCC" '// Test by looping listbox; List I for integer as i = 0 for i List 1 - 1 message box 1. List (i) & amp; "-" & amp; Muffilles (List 1. Itamdata (I)). Basic Phillippe Next '// A Better Type Focused Test; I = 0 to Ubound (muffyle) - 1 msbbx muffil (i). Basic File Path & amp; "- List entry:" & amp; List1.List (maFiles (i) .ListBoxIndex) Next End Sub as private sub AddToList (ByVal txtFileName as string) I dimmed dim integer blnFileAlreadyexists Boolean txtFileName = trim (txtFileName) so txtFileName & lt; & Gt; "" Then blnFileAlreadyexists = to I = 0 List1.ListCount false - 1, then trim (List1.List (i)) = txtFileName then blnFileAlreadyexists = not really end next blnFileAlreadyexists again in '// List1.AddItem list Then add the (txtFileName) '// original value store in the array; Muffil (Ubound) Original path = "exam:" & amp; TxtFileName '// List indicator of array in the list; List1.ItemData (List1.NewIndex) = UBound (maFiles) '// Or type maFiles (UBound (maFiles)) Better store listBoxIndex = List1.NewIndex.' // Increase the array for the next item; Redeem mafile (Ubound (muffill) + 1) End and end and end and subs, sub
Comments
Post a Comment