0

I am able to Fill data in DataGridViewComboBoxColumn on Form_Load Event there is any best Event to fill data in DataGridViewComboBoxColumn. i posted my coding. because i.e.., the way i fill the DataGridViewComboBoxColumn on form load. on FormLoad i written this code. i am getting data from that "dtcnsmbl"(my DataTable) and cnsmNm is my DataGridViewComboBoxColumn Name. i am assining DisplayMember and ValueMember properties to that one.

dtCnsmbl = prchasecls.RtrvcnsmrData();
            cnsmNm.DataSource = dtCnsmbl;
            cnsmNm.DisplayMember = dtCnsmbl.Columns["cnsm_Name"].ToString();
            cnsmNm.ValueMember = dtCnsmbl.Columns["cnsm_Id"].ToString();
Anjali
  • 1,680
  • 4
  • 26
  • 48

1 Answers1

1

Your question little bid confusing(I don't see question at all), but if my guess right, then your assigning of .DisplayMember and .ValueMember are wrong

Instead of assigning value of column, you need to tell a column name of .DisplayMember and column name of .ValueMember.

Column name must be from your datatable used as .DataSource

dtCnsmbl = prchasecls.RtrvcnsmrData();
cnsmNm.DataSource = dtCnsmbl;
cnsmNm.DisplayMember = "cnsm_Name";
cnsmNm.ValueMember = "cnsm_Id";
Fabio
  • 31,528
  • 4
  • 33
  • 72
  • My answer is working fine in Form Load, But it is not work for me at this time. so in EditinControlEvent how to fill Datagridview – Anjali Apr 08 '13 at 04:12