Problem with WinForm Application Tab Control using VB.NET2008 Framework 2.0
-
Hello all, I would like to make the Tab movement can also pressing the "Enter" Key. I have google and found the code which possible to used. But I found its not running fine with me. When I press "Enter" key,it runs fine for the tab movement. But if I put something into my textbox,it only allowed me to put 1 character and it will move next. Anyone can help me solve this? Because the Textbox 2 can able to put in any kind of numbers. But after add in the code that allowed "Enter" key move the Tabindex,it will move to the next tab index after I lick 1 character. Please help me to check is that I use this code wrongly?
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If Keys.Enter Then SendKeys.Send("{TAB}") Exit Sub End If Select Case e.KeyChar Case "0" To "9" Case Microsoft.VisualBasic.ChrW(8) 'backspace 'Case Microsoft.VisualBasic.ChrW(46) 'dot (.) ' If InStr(TextBox2.Text, ".") > 0 Then ' e.Handled = True ' End If Case Else e.Handled = True End Select End Sub
Thanks you all so much for reading. Anyone can give me some suggestion how should I do to make the "Enter" key press work as tab? Regards Drex
-
Hello all, I would like to make the Tab movement can also pressing the "Enter" Key. I have google and found the code which possible to used. But I found its not running fine with me. When I press "Enter" key,it runs fine for the tab movement. But if I put something into my textbox,it only allowed me to put 1 character and it will move next. Anyone can help me solve this? Because the Textbox 2 can able to put in any kind of numbers. But after add in the code that allowed "Enter" key move the Tabindex,it will move to the next tab index after I lick 1 character. Please help me to check is that I use this code wrongly?
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If Keys.Enter Then SendKeys.Send("{TAB}") Exit Sub End If Select Case e.KeyChar Case "0" To "9" Case Microsoft.VisualBasic.ChrW(8) 'backspace 'Case Microsoft.VisualBasic.ChrW(46) 'dot (.) ' If InStr(TextBox2.Text, ".") > 0 Then ' e.Handled = True ' End If Case Else e.Handled = True End Select End Sub
Thanks you all so much for reading. Anyone can give me some suggestion how should I do to make the "Enter" key press work as tab? Regards Drex
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress IF asc(e.KeyChar) = 13 THEN write your code into this u will get write output End If End Sub
modified on Monday, April 20, 2009 6:33 AM
-
Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress IF asc(e.KeyChar) = 13 THEN write your code into this u will get write output End If End Sub
modified on Monday, April 20, 2009 6:33 AM
Thank you so much Mr. S.M.Kanerkar. Your solution works well. Regards Drex