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
Thanks that worked. - 1 row index usually row header in win datagridview. I want to avoid row header click for that particular column
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.