Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15537

CellClick selected Datagridview row

$
0
0
With my code, I want to be able to action a cellclick on an existing datagrid.
I can set the record (ID) and highlight the row as selected (as below), however need the next step to automatically 'click' on that record as it populates other parts of the form

Code:

        For Each row As DataGridViewRow In FrmToursManage.DataGridView1.Rows
            If Not row.IsNewRow Then
                If CInt(row.Cells(0).Value) = CInt(ID) And CInt(row.Cells(0).Value) > 0 Then
                    FrmToursManage.DataGridView1.CurrentCell = FrmToursManage.DataGridView1.Rows(RowCount).Cells(1)
                    FrmToursManage.DataGridView1.Rows(RowCount).Selected = True
                    BoolClientFound = True
                    Exit For
                End If
                RowCount += 1
            End If
        Next

Is it a case of calling existing sub? If so, what parameters do I pass to it? or?:

Code:

  Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
Thanks!

Viewing all articles
Browse latest Browse all 15537

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>