Combobox using the ::SelectedIndex method

My form consists of several dropdown list 'Comboboxes' with several values in each box.

The first time into the code I'm setting up textboxes which accompany these boxes like so...

set mystring to EMPMAIN-USC-RATE(1).

set Tax-USC-R1::SelectedIndex to Tax-USC-R1::FindStringExact(mystring::TrimEnd(' '))

set uscIndex to Tax-USC-R1::SelectedIndex.

>> If Rate 1 is ZERO then disable all entry boxes for USC

if uscIndex = Zero

set TAX-USC-R1-ACO::Enabled to False

set TAX-USC-R1-PCO::Enabled to False

set TAX-USC-R2::Enabled to False

etc etc..

I have 'SelectedIndexChanged' methods attached to each Combobox where I want the user to be taken should they change the initial value thats in the Combobox. The problem is that the code is bouncing to the 'SelectedIndexChanged' method in the initial set up of the boxes which I do not want it to do. Is there a way around this problem?

e.g I only want the 'SelectedIndexChanged'  code to be done IF the user physically changes the value already present and NOT when I set the initial value?

  • Verified Answer

    You can set up a condition flag in working-storage so that you can avoid the first time selectedindex is changed.


          class-id testcomboselect.Form1 is partial
                    inherits type System.Windows.Forms.Form.
          working-storage section.
          01 isInitial   condition-value value true.
          method-id NEW.
          procedure division.
              invoke self::InitializeComponent
          end method.
          method-id Form1_Load final private.
          procedure division using by value sender as object e as type System.EventArgs.
              invoke comboBox1::Items::Add("Red")
              invoke comboBox1::Items::Add("Blue")
              invoke comboBox1::Items::Add("Green")
              invoke comboBox1::Items::Add("White")
              set comboBox1::SelectedIndex to 2
          end method.
          method-id comboBox1_SelectedIndexChanged final private.
          procedure division using by value sender as object e as type System.EventArgs.
              if isInitial
                 set isInitial to false
                 set textBox1::Text to comboBox1::SelectedItem
          end method.
          end class.

  • The combobox have limits? I create a combobox with 120 items from a file but at count=65 go out and put just the first 65 items in the combobox.