Mouse click on grouped grid

Posted by: bill on 4 April 2018, 8:24 pm EST

    • Post Options:
    • Link

    Posted 4 April 2018, 8:24 pm EST

    I have the following:

    Private Sub C1TrueDBGrid1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1TrueDBGrid1.MouseClick

        Dim Col As Integer
        Dim Row As Integer
    
        If e.Button = MouseButtons.Left Then
            If Me.C1TrueDBGrid1.Cursor Is Cursors.Hand Then 'check this otherwise any click will work
                Call C1TrueDBGrid1.CellContaining(e.X, e.Y, Row, Col)
                If Row > -1 And Col > -1 Then
                    Dim strColCaption As String = Me.C1TrueDBGrid1.Splits(0).DisplayColumns(Col).Name
                    Select Case strColCaption
                        Case "Client"
                            frmUpdate.Show()
                            frmUpdate.loadSelectedClient(C1TrueDBGrid1.Columns("cltsort").CellText(C1TrueDBGrid1.RowBookmark(Row)))
                            frmUpdate.WindowState = FormWindowState.Normal
                        Case Else
                    End Select
                End If
            End If
        End If
    End Sub
    

    This work fine with an ungrouped grid, but with a grouped grid the row returned is wrong.

    It there a way of returning the correct information with a grouped grid?

    Thanks.

  • Posted 5 April 2018, 2:06 am EST

    Hello,

    Please use following line of code instead of “Row”

    C1TrueDBGrid1.Splits(0).Rows(Row).DataRowIndex
    

    Hope it helps.

    Thanks,

    Mohit

  • Posted 5 April 2018, 6:49 pm EST

    Thanks, I will give that a try.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels