about picklist

Is there a way to prevent a user from typing in a value directly and forcing him to select an option from the picklist?

I want the same functionality for my DBGrid.Columns[i] as I can get in a ComboBox by setting the Style to csDropDownList.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

maybe you could do:

procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
key := #0;
Hopefully, your picklist is stored in a dataset somewhere.  (A ClientDataSet is ideal for this sort of thing.)  Assuming that it is, the answer is to:

Double-click the dataset that is being displayed in the DBGrid to get the fields editor.

Right-click it and Add Fields.  Add all of the fields that it suggests.

Right-click again and select New Field.
Add a lookup field - it has properties that are very similar to a DBLookupCombo.

Double-click your DBGrid to get the columns editor, and make sure that the column subject to lookup is not there, and that the lookup field is.

F9 :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you need to prevent a user from typing in a value directly, then i have
good answer.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.