日期:2014-05-19  浏览次数:21143 次

何把DataGridView中最后一行(就是会自动增加的那行)去掉
如何把DataGridView中最后一行(就是会自动增加的那行)去掉,http://topic.csdn.net/t/20031111/08/2447718.html#r_16857051这个上面有可是我不会用,有那位大侠可以说的,写得更清楚些,谢谢啦。

------解决方案--------------------
你现在绑定的数据源是什么,如果是DataTable,转换成DataView,然后设置一下AllowNew属性就可以


DataView dv = dt.DefaultView;
dv.AllowNew = false;
dataGridView1.DataSource = dv;

------解决方案--------------------
this.dataGridView1.AllowUserToAddRows = false;
------解决方案--------------------
都可以~
------解决方案--------------------
给这么多分?
选中DataGridView的属性,然后选中AllowNew 属性为 false就可以了

问题解决了,记得结帖哦
呵呵
------解决方案--------------------

选中DataGridView的属性,然后选中AllowNew 属性为 false就可以了
记得如果没有AllowNew 就选择AllowUserToAddRows这个

------解决方案--------------------
选中DataGridView的属性,然后选中AllowNew 属性为 false就可以了
记得如果没有AllowNew 就选择AllowUserToAddRows这个
------解决方案--------------------
选中DataGridView的属性,然后选中AllowNew 属性为 false就可以了

------解决方案--------------------
DataView dv = dt.DefaultView;
dv.AllowNew = false;
dataGridView1.DataSource = dv;
------解决方案--------------------

this.dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
this.dataGridView.AutoGenerateColumns = false;
this.dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.DataSource = this.bindingSource;
this.dataGridView.MultiSelect = false;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.AlternatingRowsDefaultCellStyle.BackColor = SystemColors.InactiveCaptionText;
this.dataGridView.ReadOnly = true;
this.dataGridView.RowTemplate.Height = 23;
this.dataGridView.TabIndex = 0;
------解决方案--------------------
大家都说了。我就不再多说了。接点分。。谢谢