Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
330
Displaying Row Numbers on grid
posted

I want to have the option to display row numbers. It seems like it should be pretty easy, looking at this:

https://es.infragistics.com/help/winforms/wingrid-displaying-row-numbers-in-row-selectors

But when I use this code it doesn't work:

    Private Sub chkShowRowNumbers_CheckedChanged(sender As Object, e As EventArgs) Handles chkShowRowNumbers.CheckedChanged
        If chkShowRowNumbers.CheckState = CheckState.Checked Then
            grdGrid.DisplayLayout.Override.RowSelectorStyle = RowSelectorNumberStyle.RowIndex
            grdGrid.DisplayLayout.Bands(0).Override.RowSelectorWidth = 100 '-> how do we set this width automatically?
        Else
            grdGrid.DisplayLayout.Override.RowSelectorStyle = RowSelectorNumberStyle.None
            grdGrid.DisplayLayout.Bands(0).Override.RowSelectorWidth = 20 '-> how do we set this width automatically?
        End If
    End Sub

Thanks!