Change focus Between winform Object like textbox Or comboBox and Column of datagrid by press Enter key not Tab.
we have this code for VB6:
Private Sub Text1_KeyPress (KeyAscii As Integer)
If KeyAscii = 13 Then ' The ENTER key.
SendKeys "{tab}" ' Set the focus to the next control.
KeyAscii = 0 ' Ignore this key.
End If
End Sub
what we can do in VB.net OR VB.net 2005

Change focus Between winform by press Enter
BBes
The enter key does not trigger a keydown on the datagrid, you have to handle it differently.Theres a good example of changing enter behaviour on a datagrid @ http://www.dotnet247.com/247reference/msgs/33/165586.aspx.
You can detect whether a textbox is currently supporting multiple by using
If CType(sender, TextBox).Multiline = false Then
'do cursor move
else
'allow enter
Cathal
smurfgbr
Hi And Tanks . its work.
but how I can cancel Enter key real event.
did U test it in multi line textbox
Or in data Grid when I press enter key cruser go one right and one down.
I want just cruser Go one right.
Minh PC
Sendkeys is still there, it's just in the system.windows.forms namespace. Something like the following should get you there. The e.handled is necessary to stop the beep
Cathal
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = Chr(13) Then ' The ENTER key.
System.Windows.Forms.SendKeys.Send("{tab}")
' Set the focus to the next control.e.Handled =
True Exit Sub End If