I locate the value I want in the list and set the itemindex property, all in
code. Something like:

  FoundPos := ComboBox1.Items.IndexOf(StringToFind);
  if FoundPos > -1 then begin //teacher found
    ComboBox1.ItemIndex := FoundPos;
  end else begin
    ComboBox1.ItemIndex := 0;
  end;
  ComboBox1Click(nil);

> -----Original Message-----
> From: Ross Levis [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 2 August 2001 13:36
> To: Multiple recipients of list delphi
> Subject: [DUG]: ComboBox help
> 
> 
> I must be missing something.
> 
> I need a ComboBox which is ReadOnly but also allows the text (or
> selected item) to be assigned via code.  eg. Providing a default.
> Currently when Style is csDropDownList, the Text property can not be
> assigned.  What am I missing!
> 
> Cheers,
> Ross.
> 
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to