Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Datagridview - display muliple (foreign key) database columns in a single column
 

Datagridview - display muliple (foreign key) database columns in a single column

I have a number of grid columns where i want to display two columns from a foreign key table - both in the grid and in a combo drop down for selection. I can't see how to do this - or this something that i need to add code to achieve?

regards

Paul
Paul Durdin  Thursday, October 01, 2009 8:11 AM
Hi Paul,

Based on my understanding, you want to bind the ComboBox to a table (may be datatable) and show multi-column when dropped down. That ComboBox will be used in DataGridView. Do I understand it correctly?

If so, here is an example of multi-column ComboBox.
http://www.codeproject.com/KB/combobox/multicolumncombo.aspx?msg=1336374

When you use it in DataGridView, you can handle the CellBeginEdit event to place the ComboBox below the current editing cell. Please download the whole sample from my skydrive.

http://cid-380a93ce0876cf8b.skydrive.live.com/self.aspx/Microsoft%20MSDN%20Work/Solution%20Code/DGVMultiColumnComboBox%5E52009.10.2%5E6.zip

If you have anything unclear, please feel free to tell me.

Sincerely,
Kira Qian
Send us any feedback you have about the help from MSFT at EMAIL REMOVED
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
Kira Qian  Friday, October 02, 2009 7:44 AM
Thanks for that - i'll be giving it a go later today..

Paul
Paul Durdin  Friday, October 02, 2009 10:46 AM
Hi Paul,

I am writing to check the status of the issue on your side. Could you please let me know if the suggestion works for you? If you have any questions or concerns, please feel free to let me know. I will be more than happy to be of assistance.

Sincerely,
Kira Qian
Send us any feedback you have about the help from MSFT at EMAIL REMOVED
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
Kira Qian  Tuesday, October 06, 2009 8:55 AM

You can use google to search for other answers

Custom Search

More Threads

• How to get top 10 rows of data in a datagrid
• How to restrict the user to enter only numeric values in a datagridview?
• hyperlink in datagridview
• How to bind a combo box to the current item and use a list of possible values to modify the item
• Create Secure folder in vb.net
• about datagridview to show total at footer
• List<IVehicle> objCars=list<Car> where{ Car:IVehicle} does not work, Why?
• Numeric DataGridView column
• Stuck on data relations, but I think I'm close
• New Row in the bound DataGridView