Board index » delphi » Lookup combo box in DBGrid cell

Lookup combo box in DBGrid cell

Hello,

Can someone explain to me how to put a lookup combo box in a DBGrid
cell? Note, I do not want to use an ellipsis button to open another
window and I do not want to use third-party components.

Thank you,

Eddy Young

 

Re:Lookup combo box in DBGrid cell


The way you have a lookup combo box in a dbgrid is through the picklist
property of the columns object of the grid.  I've done something like this
before:

   table1.Open;
   query1.open;
   query1.First;
   repeat
DBGrid1.Columns[1].PickList.Add(Query1.Fields[0].AsString);
       Query1.Next;
   Until Query1.EOF;

Table1 is hooked up as the datasource for the dbgrid and query1 selects the
data I want in the picklist of the dbgrid1 column.

Hope that helps.

********************************
Michael Glatz
glatzfa...@aol.com
mgl...@briefcase.com

Re:Lookup combo box in DBGrid cell


Hi Eddy,

Quote
> Can someone explain to me how to put a lookup combo box in a DBGrid
> cell? Note, I do not want to use an ellipsis button to open another
> window and I do not want to use third-party components.

If you want DBLookupCombobox you can also (aside from the other reply), get
it bij putting a lookupfield in the fieldslist of the tablecomponent (if
that's what you're using?), the column based on that field will show up in
the DBGrid as DBLookupCombobox (also works for a DBControlGrid).

Hope this helps,

Greetings, Liset

Re:Lookup combo box in DBGrid cell


Quote
Lee-Z wrote:

> Hi Eddy,

> > Can someone explain to me how to put a lookup combo box in a DBGrid
> > cell? Note, I do not want to use an ellipsis button to open another
> > window and I do not want to use third-party components.

> If you want DBLookupCombobox you can also (aside from the other reply), get
> it bij putting a lookupfield in the fieldslist of the tablecomponent (if
> that's what you're using?), the column based on that field will show up in
> the DBGrid as DBLookupCombobox (also works for a DBControlGrid).

> Hope this helps,

> Greetings, Liset

It does, Liset. Thanks.

Other Threads