I'm using the following code to number the DGV rows in the Row HeaderCell...
and it works, but the row header blinks like it's constantly cycling through the numbers and the app is sluggish.Code:Private Sub DataGridViewTable_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles DataGridViewTable.CellFormatting DataGridViewTable.Rows(e.RowIndex).HeaderCell.Value = CStr(e.RowIndex + 1) End Sub
What am I doing wrong?
EDIT...
Changed up the code a bit, removed it from CellFormatting and call it whenever the rowcount changes. All is well.
Still not sure why so if anyone knows please enlighten me.Code:For rowNum As Integer = 0 To .Rows.Count - 1 DataGridViewTable.Rows(rowNum).HeaderCell.Value = (rowNum + 1).ToString Next




Reply With Quote
