楼上没错!我就是因为没有SELECT 那个主键!我现在 SELECT ID, ... where ....Fill()后,如何让ID这以列不显示在DATAGRID中?如何隐藏它?li_new(重获新生) 不要跑,分数大大的有!
通过将列的 Width 属性设置为 0 并指定要隐藏的列的列索引来隐藏列。 例如: private void hideColumn() { // Set the DataGridTableStyle.MappingName property // to the table in the data source to map to. ts.MappingName = dataGrid1.DataMember; // Add it to the datagrid's TableStyles collection dataGrid1.TableStyles.Add(ts); // Hide the first column (index 0) dataGrid1.TableStyles[0].GridColumnStyles[0].Width = 0; }
li_new(重获新生) 我搞定了,进来领分!
还有,你必须声明变量的: // Declare a new DataGridTableStyle in the // declarations area of your form. DataGridTableStyle ts = new DataGridTableStyle();
楼上没错!我就是因为没有SELECT 那个主键!我现在 SELECT ID, ... where ....Fill()后,如何让ID这以列不显示在DATAGRID中?如何隐藏它?li_new(重获新生) 不要跑,分数大大的有!
例如:
private void hideColumn()
{
// Set the DataGridTableStyle.MappingName property
// to the table in the data source to map to.
ts.MappingName = dataGrid1.DataMember; // Add it to the datagrid's TableStyles collection
dataGrid1.TableStyles.Add(ts); // Hide the first column (index 0)
dataGrid1.TableStyles[0].GridColumnStyles[0].Width = 0;
}
我搞定了,进来领分!
// Declare a new DataGridTableStyle in the
// declarations area of your form.
DataGridTableStyle ts = new DataGridTableStyle();
li_new(重获新生) 然后再进下面这个帖子回复http://community.csdn.net/Expert/topic/3078/3078638.xml?temp=.9134485