Is it possible to have a dropdown box in a datagrid?

G

Guest

Is it possible to have a dropdown box in a datagrid record in the same way
you can have it in an Access table?

E.g.: When I populate my child table, I have a field which lookup a value in
the parent table. Access allow this and makes it easy to ensure that the user
can't enter anything else than what is available on the list. I would like to
duplicate this functionality in my datagrid. Otherwise I will have to use
list and combo boxes instead of the datagrid to help the user enter child
records correctly.

Any Ideas?
 
G

Guest

Use ItemTemplate in datagrid declaration which you can bind at runtime to a
specific datasource.
Put DropDown listbox as an item in ItemTemplate so that you will get
expected result.

Reg.
Prasad
 
C

Cor Ligthert [MVP]

Paul,

I assume you are talking about a windowsform datagrid.
In VS 2005 this is standard in the datagridview

For the older versions there are plenty of samples on Internet.
This one is the latest I have done changing them to get them usable with
option strict on in VBNet. (There is another one as well, known on internet
as the comboboxcolumn, on our website)

http://www.windowsformsdatagridhelp.com/default.aspx?ID=1eb83247-7464-467e-a9dd-faf92f41f563

I hope this helps,

Cor
 
G

Guest

Thanks a million, especially for the link to your website! Your samples are
so simple to use and at the same time so advanced!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top