[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 554
  • Last Modified:

get position in datagrid with tabindexchange function

How can I get the position of in the datagrid using the tabindexchange function.  Thanks

Private Sub DataGrid1_TabIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.TabIndexChanged
        Dim x, y
       

        Dim pt = New Point(e.X, e.Y)

        Dim hti As DataGrid.HitTestInfo = DataGrid1.HitTest(pt)

        If hti.Type = DataGrid.HitTestType.Cell Then

            DataGrid1.CurrentCell = New DataGridCell(hti.Row, hti.Column)
            DataGrid1.Select(hti.Row)
            DataGrid1.Item(hti.Row, 0) = recordid 'Column 1
        End If
    End Sub
0
running32
Asked:
running32
1 Solution
 
HillwaaaCommented:
Hi running32,

Are you sure you want the TabIndexChanged function?  This is triggered when the TabIndex value of the DataGrid is changed - i.e. the order in which you tab to the DataGrid in the form changes - not when you hit the tab key within the DataGrid.

Assuming that you are trying to find the position of the current cell in the datagrid with the tab key is pressed, then use:
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
    MessageBox.Show("row: " & DataGrid_workEntries.CurrentCell.RowNumber)
End Sub

Let me know if my assumption was wrong!!

Cheers!
0
 
running32Author Commented:
Great, thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now