Created On:  29 August 2012

Problem:

A Visual COBOL Windows Forms application has a form on which a combo box control has been placed.  The combo box is statically populates with a list of strings.  The application retrieves data from an indexed file and needs to search the entries in the combo box to compare them with the value of one of the fields in the data record.

When it finds a match it needs to set the current index of the combo box to the position within the combo box where the compare was true.  How can this be done?

Resolution:

Something like the following should work:

      01 compareField    string.
      01 emp-type          pic x(20)  value "Full Time".

          set compareField to emp-field

          set comboBox1::SelectedIndex to comboBox1::FindStringExact(compareField::TrimEnd(' '))