Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keypress Event Switching to a second datagrid

Status
Not open for further replies.

bigmelon

MIS
Sep 25, 2003
114
US
i have a textbox and on enter it selects the correct row in the first datagrid. Then on enter I want it to jump from the first datagrid to the second. For some reason the keypress event doesn't fire the first time, but if I select the row again then it works. Any idea why the event is not raised the first time, but is then fired the second time?

Thanks in advance,

Jeremy
 
could you post your code for the textbox and the datagrid?

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Private Sub txtFind_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtFind.KeyDown
If (e.KeyCode = Keys.Enter) Then
grdFind.Focus()
grdFind.Select(grdFind.CurrentRowIndex)
End If
End Sub

Private Sub grdFind_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles grdFind.KeyPress
If e.KeyChar = ControlChars.Cr Then
grdInfo.Focus()
grdInfo.Select(grdInfo.CurrentRowIndex)
End If
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top