none
fill datagridview row header with text number RRS feed

  • Question

  • hi

    i want to  fill datagridview row header with text number

    Use this method to add numbering to the head of each row but after certain numbers
    The numbers do not appear complete and a part of the numbers appear to show complete.
    No matter how many rows are filled, the head of each row is filled

     Private Sub DATAG_EMPLOYEDET_RowsAdded(ByVal sender As Object, ByVal e As DataGridViewRowsAddedEventArgs) Handles DATAGR_DETAILS.RowsAdded
            Try
                For i = 0 To DATAGR_DETAILS.RowCount - 1
                    DATAGR_DETAILS.Rows(i).HeaderCell.Value = CStr(i + 10000)
                Next
            Catch ex As Exception
                Exit Sub
            End Try
    
        End Sub
    
        Private Sub DATAG_EMPLOYEDET_RowsRemoved(ByVal sender As Object, ByVal e As DataGridViewRowsRemovedEventArgs) Handles DATAGR_DETAILS.RowsRemoved
            Try
                For i = 0 To DATAGR_DETAILS.RowCount - 1
                    DATAGR_DETAILS.Rows(i).HeaderCell.Value = CStr(i + 10000)
                Next
            Catch ex As Exception
                Exit Sub
            End Try
        End Sub

    I tried to see the numbers after 10,000 and the natural number was 1

    Thursday, February 28, 2019 5:31 PM

Answers

  • Hi

    It seems your code does work OK,but, you might need to set the row header width to a larger value to see the numbers fully.

    e.g.

    DATAGR_DETAILS.RowHeadersWidth = 100



    Regards Les, Livingston, Scotland


    • Edited by leshay Thursday, February 28, 2019 5:50 PM
    • Marked as answer by ahmeddc Thursday, February 28, 2019 7:16 PM
    Thursday, February 28, 2019 5:49 PM