C#datagridview列排序模式自动抛出错误

时间:2017-05-10 08:22:33

标签: c# datagridview

我制作了几个有datagridview的表单。当我点击标题进行排序时,某些表格会引发我的指数超出范围。必须是非负数且小于集合的大小。参数名称:index'和其他工作。所有表单都从数据库中获取数据。

数据绑定:

dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource = conn.selectData("select * from customer").Tables[0];
            dataGridView1.Columns["id"].DataPropertyName = "idCust";
            dataGridView1.Columns["namadg"].DataPropertyName = "namaCust";
            dataGridView1.Columns["alamatdg"].DataPropertyName = "alamatCust";
            dataGridView1.Columns["telpdg"].DataPropertyName = "telpCust";
            dataGridView1.Columns["emaildg"].DataPropertyName = "emailCust";
            dataGridView1.Columns["keterangandg"].DataPropertyName = "keterangan";
            dataGridView1.Columns["memberdg"].DataPropertyName = "member";
            dataGridView1.Columns["tglmemberdg"].DataPropertyName = "tglMember";
            dataGridView1.Columns["noMemberdg"].DataPropertyName = "noMember";

0 个答案:

没有答案