.net - AddRowEvent in DataGridView Adding Extra Row -


I have an infinite DataGridView. I'm trying to finish the extra line being added at the end. I have set AllowUserToAddRows to false.

  // This code is adding more than two rows to this.dataGridView1.AllowUserToAddRows = false; This.dataGridView1.Rows.Add (New DataGridViewRow ()); DataGridView1.NotifyCurrentCellDirty (true); DataGridView1.CommitEdit (DataGridViewDataErrorContexts.Commit); DataGridView1.NotifyCurrentCellDirty (wrong);  

I have this setup when users click on a line, they can add an additional line. . However, if I click on the correct last line, it will add two rows in it

  Private Zero addRowBelowToolStripMenuItem_Click (Object Sender, EventArgs e) {if (_selectedRow & lt; dataGridView1.RowCount - 1) { DataGridView1.Rows.Instert (_selectedRow + 1, 1); } And {dataGridView1.Rows.Add (); } DataGridView1.NotifyCurrentCellDirty (true); DataGridView1.CommitEdit (DataGridViewDataErrorContexts.Commit); DataGridView1.NotifyCurrentCellDirty (wrong); } " 

So if newrowneeded is called just set

  this.dataGridView1.AllowUserToAddRows = true;  

And add some rows with:

  dataGridView1.Rows.Add ();  

Hope this will help you! You see!


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -