As per the specified code, when I press "F5" in the 1st column, last blank row of a grid, a second form will be activated. But the problem is.. after the activation of the second form, its loosing the focus from the last row to one step up (second last row) and also focus is going to another control. I have tried in the load event of the second form Me.MdiParent = FrmMain. If I removed this code (Me.MdiParent = FrmMain), its working perfectly. I mean the focus will not be change to anywhere. But I should include this code. What I should do masters?
What I have tried:
Private Sub grdDayBook_KeyDown(ByVal Sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles grdDayBook.KeyDown
If CurrentColumn = 1 Then
If e.KeyCode = Keys.F5 Then
'e.SuppressKeyPress = True
FrmAccountsSearch.MdiParent = FrmMain
FrmAccountsSearch.Text = "From Daybook"
FrmAccountsSearch.Show()
FrmAccountsSearch.Activate()
End If
End If
End Sub