Combobox IndexOf

Viewing 2 reply threads
  • Author
    Posts
    • #1955
      Barry Wood
      Participant

        Hi

        I often use the Value pairs in a combo box, and easily get the ‘value’ from the current index. I have also used the IndexOf to check if a certain item is in the list, but that checks the Name side not the Value side.

        Is there a way to check if an item is in the Value side of a combobox?

      • #1957
        Ray Konopka
        Keymaster

          Hi Barry,

          You can use the Values string list and use the IndexOf method on that to get the index of the item that contains the value you are looking for.

          procedure TForm25.RzButton1Click(Sender: TObject);
          var
            Idx: Integer;
          begin
            Idx := RzComboBox1.Values.IndexOf( 'SomeValue' );
            RzComboBox1.ItemIndex := Idx;
          end;

          Ray

        • #1962
          Barry Wood
          Participant

            As ever, thanks Ray.

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.