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
515
Column Index Problem
posted

I am using the following code

 Private Sub ugSalesList_ClickCell(ByVal sender As Object, ByVal e As ClickCellEventArgs) Handles ugSalesList.ClickCell

        If e.Cell.Column.Index = 0 AndAlso e.Cell.Row.Index > -1 Then
            Try
                Me.Cursor = Cursors.WaitCursor
                With New SalesReceiptView
                    .MdiParent = MdiView
                    .Dock = DockStyle.Fill
                    .Text = "Receipt " & e.Cell.Value.ToString
                    .Show()
                    .GetReceipt(CInt(e.Cell.Value))
                End With
            Finally
                Me.Cursor = Cursors.Default
            End Try
        End If

 End Sub

This code works fine in my development system and many other customer systems except one customer where the column index 3 comes as column 0. Can somebody help on this! please

Parents
  • 469350
    Verified Answer
    Offline posted

    Using the Column index and the Row index is usually not a good idea. The column index can change because the user can move the columns around by default.

    If you want to base an action on a particular column, you should use the column's Key.

    For the row, I'm not sure what a row index of -1 means. This is probably the last fixed row, so this could once again be ambiguous. My guess is that you probably intended this to be the FilterRow or maybe a fixed AddNew row. There are properties on the row for this which would be much more reliable than the index, like IsAddRow, IsTemplateAddRow, or IsFilterRow.

Reply Children
No Data