Skip to main content

Populate Listbox with Table Data in WinForm

  • September 3, 2020
  • 1 reply
  • 1 view

Alexander Castro

I have the following table declared in my WinForm

 

01 TABLE-NUM OCCURS 5 TIMES.

 

How do I load TABLE-NUM into my ListBox?

For example, my Table has the following :

TABLE-NUM(1) = “1”

TABLE-NUM(2) = “2”

TABLE-NUM(3) = “3”

TABLE-NUM(4) = “4”

TABLE-NUM(5) = “5”

 

I want my List Box to display the Table data from which the user can select an entry as follows:

1

2

3

4

5

1 reply

Alexander Castro
  • Author
  • Participating Frequently
  • September 4, 2020

I have the following table declared in my WinForm

 

01 TABLE-NUM OCCURS 5 TIMES.

 

How do I load TABLE-NUM into my ListBox?

For example, my Table has the following :

TABLE-NUM(1) = “1”

TABLE-NUM(2) = “2”

TABLE-NUM(3) = “3”

TABLE-NUM(4) = “4”

TABLE-NUM(5) = “5”

 

I want my List Box to display the Table data from which the user can select an entry as follows:

1

2

3

4

5

I solved this as follows:


perform varying THE-IDX from 1 by 1
until THE-IDX > 5
move TABLE-NUM(THE-IDX) TO TMP-NUM
invoke lst-TABLE-NUM::Items::Add(TMP-NUM)
end-perform.