Solved

get position in datagrid with tabindexchange function

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

912 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

19 Experts available now in Live!

Get 1:1 Help Now