Create List from txt file

Started by dsm_dude, June 16, 2021, 02:28:51 PM

Previous topic - Next topic

dsm_dude

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.


diogenes

You can use the "onselchanged" event in ListBox1 to update ListBox2 as needed.

dsm_dude

#2
How do I go about populating the listbox from the text file?

This is where I'm currently stuck.

diogenes

1.- Clear list box to be filled
2.- read the txt file and select the data you want
3.- fill the list box.