troubleshooting Question


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
            Dim row As DataGridViewRow = dgrid.SelectedRows(0)
        End If
    End Sub

Open in new window

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

Open in new window


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 our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
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