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!

Parents
No Data
Reply
  • 25665
    Verified Answer
    Offline posted

    Hello Ted,

    Thank you for contacting Infragistics!

    Looking at your code you appear to not be getting row numbers because you are not setting the proper row selector style. You are setting RowSelectorStyle, instead you want to set RowSelectorNumberStyle, for example:

    ultraGrid1.DisplayLayout.Override.RowSelectorNumberStyle = RowSelectorNumberStyle.RowIndex

Children