Solved

get position in datagrid with tabindexchange function

Posted on 2006-11-15
2
505 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
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now