Friends, I've a datagridview in my windows application. It has 6 columns, out of which the 2nd(colindex 1) is of type combobox. Others are of textbox type. I've to populate this combobox from table1. There are two columns in table1 - ID and Name. Only Name will be displayed in the combobox. User can select any one from that combobox and write something in other 5 columns. Upon pressing save button, the ID of the selectedItem from combobox and other 5 textboxes' value will be stored in table2. When again the form will be loaded it'll fetch data from table2 and display corresponding data in datagridview. I've used datasource to populate the combobox. But it's not working. Do any one of you have any idea, how can I do it?
Asked
Active
Viewed 326 times
0
-
Can you post the source code? – Chris Gessler Apr 18 '12 at 12:43
-
**Not working** doesn't help, can you show some code ? – V4Vendetta Apr 18 '12 at 12:43
-
I've bound the column in design time.How will I get code? – Sukanya Apr 18 '12 at 12:49
1 Answers
0
Try Setting the DisplayMember
of the combobox to "Name"
and the ValueMember
of the combobox to ID
.
And Also the bindings (For that matter any changes) you perform at design time is in InitializeComponent
method of your class, depending on the version of Visual Studio you're using, It'll reside in a same or separate file.

abhilash
- 5,605
- 3
- 36
- 59