Filling list boxes in .NET code

[Migrated content. Thread originally posted on 11 May 2012]

The following code doesn't seem to display my listbox contents after performing it. What am I missing?

method-id LBox_Button_Click final private.
local-storage section.
01 my-listbox type System.Windows.Forms.ListBox.
01 companyName type String.
procedure division using by value sender as object e as type System.EventArgs.

set my-listbox to new System.Windows.Forms.ListBox
invoke my-listbox::BeginUpdate

move "Fred" to companyName
invoke my-listbox::Items::Add(companyName)

invoke my-listbox::EndUpdate

end method.
Parents
  • There are many ways of doing this including using binding as I mentioned earlier but the most simple is probably something like:


        set BankList::Items::Item(indexOfSelection) to newitem


    where indexofSelection contains the index of the item to change and newitem is the modified item.

    You can also use add, remove. etc methods to change items in listbox item collection.
Reply
  • There are many ways of doing this including using binding as I mentioned earlier but the most simple is probably something like:


        set BankList::Items::Item(indexOfSelection) to newitem


    where indexofSelection contains the index of the item to change and newitem is the modified item.

    You can also use add, remove. etc methods to change items in listbox item collection.
Children
No Data