本文介绍了如何避免在DataGridView中绑定Emptyrow?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨以下是我的设计师代码:

HiThe below is my designer code:

this.dgridAddProperties.AllowUserToResizeRows = false;
this.dgridAddProperties.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgridAddProperties.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.dgridAddProperties.BackgroundColor = System.Drawing.Color.White;
this.dgridAddProperties.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
this.dgridAddProperties.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
this.dgridAddProperties.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgridAddProperties.Location = new System.Drawing.Point(7, 32);
this.dgridAddProperties.Name = "dgridAddProperties";
this.dgridAddProperties.RowHeadersVisible = false;
dataGridViewCellStyle1.NullValue = null;
this.dgridAddProperties.RowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgridAddProperties.Size = new System.Drawing.Size(321, 170);
this.dgridAddProperties.TabIndex = 12;
this.dgridAddProperties.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgridAddProperties_CellContentDoubleClick);


当我将DataTable绑定到DataGridView时(将空记录添加到DataGridView中)
例如:DataTable1.Rows.Count = 12;
但是:DataGridView1.Rows.Count = 13;
如果您有任何想法,请告诉我.

问候,
帕湾.

[更正了某些格式]


When i am binding DataTable to DataGridView (null record is added to the DataGridView)
Ex: DataTable1.Rows.Count = 12;,
but: DataGridView1.Rows.Count = 13;
Let me know if you have any idea.

Regards,
Pawan.

[Corrected some formatting]

推荐答案



这篇关于如何避免在DataGridView中绑定Emptyrow?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 02:51