2 u011070946 u011070946 于 2013.06.16 15:06 提问

C# 中在datagridview中实例化了一些列,如何将把数据在这些列中显示出来?

D private void FrmIsDo_Load(object sender, EventArgs e)
{
ataGridViewTextBoxColumn column3 = new DataGridViewTextBoxColumn();
column3.HeaderText = "核定年月";
column3.Name = "column3";
dataGridView1.Columns.Add(column3);
DataGridViewTextBoxColumn column4 = new DataGridViewTextBoxColumn();
column4.HeaderText = "员工姓名";
column4.Name = "column4";
dataGridView1.Columns.Add(column4);
DataGridViewCheckBoxColumn column5 = new DataGridViewCheckBoxColumn();
column5.HeaderText = "养老企业核定";
column5.Name = "column5";
column5.DataPropertyName = "IsChecked";
dataGridView1.Columns.Add(column5);
DataGridViewCheckBoxColumn column6 = new DataGridViewCheckBoxColumn();
column6.HeaderText = "养老个人核定";
column6.Name = "column6";
column6.DataPropertyName = "IsChecked";
dataGridView1.Columns.Add(column6);
}
如何将数据表TB_IsDo里面的数据加上去,对应到这些列中?求解答?

1个回答

u010030637
u010030637   2013.06.17 19:26

把表里的列名和DataGridView 里的DataPropertyName的属性绑定一下,相应的列绑定相应的数据。这样就可以了

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!