有两种方法:
1.在dataGrid中的属性用dataSource绑定dataSet,dataMember绑定dataSet.数据表。然后用dataGrid中的TableStyles来绑定列
2.在oleDbDataAdapter属性中的TableMapping中映射列
1.在dataGrid中的属性用dataSource绑定dataSet,dataMember绑定dataSet.数据表。然后用dataGrid中的TableStyles来绑定列
2.在oleDbDataAdapter属性中的TableMapping中映射列
this.description.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.description.Format = "";
this.description.FormatInfo = null;
this.description.HeaderText = "说明";
this.description.MappingName = "Description";
this.description.ReadOnly = true;
this.description.Width = 75;但是在使用DataSource = myDataTable,绑定类型为DataTable的数据源后,标题显示的还是DataTable中的标题, 而不是我定义的DataGrid标题,这是为什么?
DataView ds = new DataView(你的dataSet)DataSource =ds
this.dataGrid1.TableStyles = this.dataGridTableStyle1;
的代码看看
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp