Hi,
this is probably really easy but I'm a C++ programer and I'm still trying to find my way around Delphi.
I have a combo box and an edit box on a form. If the user adds text to the edit box and clicks a button on my form I want the text to be added to the combo box (this I can do), and I also want the new text item to be highlighted/selected within the combo box.
How do I select an item in the combo box programmatically? I know what the text that I just added is, can I search for that?
Here is a wee bit of my code:
(where EditOther is the edit box)
if EditOther.Text <> '' then begin
ReasonsComboBox.Items.Add(EditOther.Text);
// TODO: highlight (select) the new reason in the combo box.
EditOther.Text := '';
end;
this is probably really easy but I'm a C++ programer and I'm still trying to find my way around Delphi.
I have a combo box and an edit box on a form. If the user adds text to the edit box and clicks a button on my form I want the text to be added to the combo box (this I can do), and I also want the new text item to be highlighted/selected within the combo box.
How do I select an item in the combo box programmatically? I know what the text that I just added is, can I search for that?
Here is a wee bit of my code:
(where EditOther is the edit box)
if EditOther.Text <> '' then begin
ReasonsComboBox.Items.Add(EditOther.Text);
// TODO: highlight (select) the new reason in the combo box.
EditOther.Text := '';
end;