Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to display text in a DBlookupcombobox? 1

Status
Not open for further replies.

pierrotsc

Programmer
Nov 25, 2007
358
US
I have a DBloolupcombobox associated with an table from an absolute database.
I want to display the first record value and not a blank value in it when my program starts in the onactivate event.

I tried: DBLookupcombobox.text:=TableTrial.FieldByName('TrialName').AsString; but it says that the left side is read-only.

I hope i am making sense.Right now when i click on the pull down arrow, I see all my values from the tables. I just want to display the first value in thge table and not a blank value.

Thanks.
P
 
What you have to understand is that the dblookupcombobox always displays the current value reflected in the 'fieldname' of your 'datasource', and looks up that value and displays the 'listfield' of your 'listsource'. So if the fieldname value is null, no value will be selected (i.e. displayed), if there's a value, it looks up the value and displays it.

Whether there's a value in your datasource or not, all the items in the 'listsource' should be made available in the dropdown.
 
I figured it out. Your answer pointed me to the right track. I was using the wrong component.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top