The following code will override the rowpostpaint event and number the rows in the datagridview. I am resizing the header statically here, you may want to be more dynamic with how you will size the header to deal w/ large row numbers.
Mydasx
PLEASE RETURN POINTS
Private Sub dataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
Dim blackBrush As SolidBrush = New SolidBrush(DataGridView1.RowHeadersDefaultCellStyle.ForeColor)
e.Graphics.DrawString(e.RowIndex.ToString(System.Globalization.CultureInfo.CurrentUICulture), DataGridView1.DefaultCellStyle.Font, redBrush, e.RowBounds.Location.X + 10, e.RowBounds.Location.Y + 4)
blackBrush.Dispose()
Dim totalRows As Integer = Me.masterSched.ToSchedule().RDPList.Count
Dim numberWide As String = totalRows.ToString()
Dim width As Integer = numberWide.Length
Me.DataGridView1.RowHeadersWidth = e.RowBounds.Location.X + 10 + width * 10
End Sub
ASKER
Mydasx
PLEASE RETURN POINTS
Private Sub dataGridView1_RowPostPaint
Dim blackBrush As SolidBrush = New SolidBrush(DataGridView1.R
e.Graphics.DrawString(e.Ro
blackBrush.Dispose()
Dim totalRows As Integer = Me.masterSched.ToSchedule(
Dim numberWide As String = totalRows.ToString()
Dim width As Integer = numberWide.Length
Me.DataGridView1.RowHeader
End Sub