Create List from txt file

Started by dsm_dude · 2021-06-16 21:28 UTC · 3 replies · SMF topic #2777

I'm looking for a way to populate a listbox with the first line of a txt file (attached).


Now this might be the tricky part.

I have another listbox that have a list based off my txt files. I would like the ListBox2 to load based off the corresponding ListBox1 selection.
(dcl-ListBox-AddList Steel2D/Form1/ListBox1 (list "HM" "HN" "HW" "I" "HT" "TM" "TN" "TW" "C" "L" "CHS" "RHS" "SHS"))


For example, when I select "HM" in ListBox1 it will Load "HM.txt" (which is attached) into ListBox2.

Attachments
You can use the "onselchanged" event in ListBox1 to update ListBox2 as needed.
How do I go about populating the listbox from the text file?

This is where I'm currently stuck.
1.- Clear list box to be filled
2.- read the txt file and select the data you want
3.- fill the list box.