Problem with dataGridComboBoxColumn object in VC# 2005
-
hi i was add dataGridComboBoxColumn in my datagridview and write this code to bind it to my column :
this.personPropertiesTableAdapter.Fill(this.dataSet_AddressBook.PersonProperties); dataGridComboBoxColumn.DataSource = this.dataSet_AddressBook.PersonProperties; dataGridComboBoxColumn.ValueMember = "CategoryName";
but when i fill dataset, value don't show in dataGridComboBoxColumn and i must select dataGridComboBoxColumn and select that value from combo list,but i want when i fill dataset,value show on dataGridComboBoxColumn,but how to do ? thanks -
hi i was add dataGridComboBoxColumn in my datagridview and write this code to bind it to my column :
this.personPropertiesTableAdapter.Fill(this.dataSet_AddressBook.PersonProperties); dataGridComboBoxColumn.DataSource = this.dataSet_AddressBook.PersonProperties; dataGridComboBoxColumn.ValueMember = "CategoryName";
but when i fill dataset, value don't show in dataGridComboBoxColumn and i must select dataGridComboBoxColumn and select that value from combo list,but i want when i fill dataset,value show on dataGridComboBoxColumn,but how to do ? thanksI design a class to DataGridViewComboBoxColumn and OTHERS when u want to bind data , u use : ClassLibrary_Pharm.Class_ComboBindData.u_ComboBindData(dataGridComboBoxColumn,"PersonProperties",SqlConnectionstring); follow is my project code, u can modify it using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Data; namespace ClassLibrary_Pharm { public static class Class_ComboBindData { public static bool u_ComboBindData(object combo, string sTopic) { return u_ComboBindData(combo, sTopic, null); } public static bool u_ComboBindData(object combo, string sTopic, EcareHis.C.Common.His_LogOn Logon) { bool blReturn = false; DataSet ds = null; switch (sTopic.ToLower().Trim()) { case "sex": ds = u_GetSexual(); break; case "stay": ds = u_GetStay(); break; case "readyflag": ds = u_GetConfect(); break; case "department": ds = u_GetDeptEmp(Logon,"epr"); break; case "code213": ds = u_GetCodeTable(Logon, "realhis","code213"); break; case "code211": ds = u_GetCodeTable(Logon, "realhis", "code211"); break; case "code212": ds = u_GetCodeTable(Logon, "realhis", "code212"); break; } if (ds == null) throw new Exception("not rows" + sTopic); if (ds.Tables["param"].Rows.Count < 1) throw new Exception("row count < 1" + sTopic); switch (combo.GetType().ToString()) { case "System.Windows.Forms.ComboBox": ((ComboBox)combo).DataSource = ds.Tables["param"]; ((ComboBox)combo).ValueMember = "value"; ((ComboBox)combo).DisplayMember = "mark"; break; case "System.Windows.Forms.DataGridViewComboBoxColumn": ((DataGridViewComboBoxColumn)combo).DataSource = ds.Tables["param"]; ((DataGridViewComboBoxColumn)combo).ValueMember = "value"; ((DataGridViewComboBoxColumn)combo).DisplayMember = "mark";