Solved

get position in datagrid with tabindexchange function

Posted on 2006-11-15
2
538 Views
Last Modified: 2012-08-13
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
Comment
Question by:running32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
Hillwaaa earned 500 total points
ID: 17951162
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
 

Author Comment

by:running32
ID: 17958367
Great, thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question