troubleshooting Question

Datagridview

Avatar of GRChandrashekar
GRChandrashekarFlag for India asked on
Visual Basic.NET
8 Comments1 Solution282 ViewsLast Modified:
Private Sub DgridKeyDown(sender As System.Object,
                             e As Windows.Forms.KeyEventArgs) Handles dgrid.KeyDown
        Dim crRowIndex As Integer = dgrid.CurrentCell.RowIndex
        If crRowIndex + 1 = dgrid.Rows.Count Then
        Else
            Dim row As DataGridViewRow = dgrid.SelectedRows(0)
            Loadcontrolsfromgridview(row)
        End If
    End Sub
Private Sub Loadcontrolsfromgridview(row As DataGridViewRow)
        _primarykey = 0
        tbxdescription.Text = row.Cells("Description").Value
        _primarykey = row.Cells("TitleID").Value
        btnsave.Text = "Update [F2]"
    End Sub
Hi,

The Problem with above code is
1. unless I click on the circled place and press enter, the data wont get loaded in textbox.
2. Pressing enter should not move to next row in grid. Only arrow keys should be used to navigate.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros