Author Topic: Create List from txt file  (Read 190 times)

dsm_dude

  • Member
  • *
  • Posts: 7
Create List from txt file
« on: June 16, 2021, 02:28:51 PM »
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.
Code: [Select]
(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

  • Member
  • *
  • Posts: 27
Re: Create List from txt file
« Reply #1 on: June 17, 2021, 01:17:52 AM »
You can use the "onselchanged" event in ListBox1 to update ListBox2 as needed.

dsm_dude

  • Member
  • *
  • Posts: 7
Re: Create List from txt file
« Reply #2 on: June 17, 2021, 04:19:13 AM »
How do I go about populating the listbox from the text file?

This is where I'm currently stuck.
« Last Edit: June 17, 2021, 05:47:16 AM by dsm_dude »

diogenes

  • Member
  • *
  • Posts: 27
Re: Create List from txt file
« Reply #3 on: June 22, 2021, 03:25:48 AM »
1.- Clear list box to be filled
2.- read the txt file and select the data you want
3.- fill the list box.