Click here to Skip to main content
16,022,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I don't understand why this is so difficult. I've never posted a C# question but I can't seem to figure out the use of DataGridViewComboBoxColumn with DisplayMember and ValueMember.

Any help would be greatly appreciated:

C#
DataGridViewComboBoxColumn cbCol = new DataGridViewComboBoxColumn();
cbCol.DefaultCellStyle.NullValue = "--Select--"; 
cbCol.FlatStyle = FlatStyle.Popup;
cbCol.DataSource = new functions_sqls().select("select distinct l.list_value vm, l.long_description dm from lists l");
cbCol.DisplayMember = "dm";
cbCol.ValueMember = "vm";    
cbCol.Name = Col.ToString();
dgv1.Columns.Add(cbCol);


Thanks,
Scott
Posted
Comments
Sandeep Mewara 15-May-12 2:53am    
Not clear on what is your issue! Can you add couple of lines on what is troubling you?

1 solution

hi here is link with similar problem may be you'll get an idea

http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/a9dfc124-9d96-4183-b483-ce54d61cc703[^]

thanks.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900