enter key

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2006
Posts: 13
Reputation: vb_learner is an unknown quantity at this point 
Solved Threads: 0
vb_learner vb_learner is offline Offline
Newbie Poster

enter key

 
0
  #1
Nov 8th, 2006
Hello

Iam using windows application, I want to know how can I move from textbox1 to textbox2 through the tab control key or enter key..
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: enter key

 
0
  #2
Nov 9th, 2006
or you could just use the mouse and position the cursor in which ever text box you want?
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: enter key

 
0
  #3
Nov 9th, 2006
Try this:
  1. Private Sub TextBox1_Keydown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown, TextBox2.KeyDown
  2. If e.KeyCode = Keys.Tab Then
  3. If sender.Name = "TextBox1" Then
  4. TextBox2.Focus()
  5. e.Handled = True
  6. ElseIf sender.Name = "TextBox2" Then
  7. TextBox1.Focus()
  8. e.Handled = True
  9. End If
  10. End If
  11. End Sub
  12.  
  13. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress, TextBox2.KeyPress
  14. If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
  15. If sender.name = "TextBox1" Then
  16. TextBox2.Focus()
  17. e.Handled = True
  18. ElseIf sender.name = "TextBox2" Then
  19. TextBox1.Focus()
  20. e.Handled = True
  21. End If
  22. End If
  23. End Sub
Last edited by waynespangler; Nov 9th, 2006 at 4:17 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 13
Reputation: vb_learner is an unknown quantity at this point 
Solved Threads: 0
vb_learner vb_learner is offline Offline
Newbie Poster

Re: enter key

 
0
  #4
Nov 10th, 2006
1)the tab works by default right?

2)I added the enter code but still when i start my program the focus is always at the 2nd text box, so what can i do?
3) can i move between textboxes using the ASCII code 13? how?
thanks : )
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: enter key

 
0
  #5
Nov 10th, 2006
You don't want to do this. The "enter" key is universally used to submit a form, or perform a default action. Altering it is a major violation of the User Model.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 13
Reputation: vb_learner is an unknown quantity at this point 
Solved Threads: 0
vb_learner vb_learner is offline Offline
Newbie Poster

Re: enter key

 
0
  #6
Nov 10th, 2006
sorry but i didn't understand ;/ ,,
what i meant is using enter key to move from one text box to another..
and how I can do it..

I'm very new to programming. .
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: enter key

 
0
  #7
Nov 10th, 2006
Originally Posted by vb_learner View Post
sorry but i didn't understand ;/ ,,
what i meant is using enter key to move from one text box to another..
and how I can do it..

I'm very new to programming. .
In the GUI tab there should be an option in the text box to enable or disable the tab key. If it is disabled you should be able to use it to go through different buttons and text fields.

But using enter to do the same would be frowned upon.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: enter key

 
0
  #8
Nov 10th, 2006
see attachment
Attached Thumbnails
crap.GIF  
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 13
Reputation: vb_learner is an unknown quantity at this point 
Solved Threads: 0
vb_learner vb_learner is offline Offline
Newbie Poster

Re: enter key

 
0
  #9
Nov 14th, 2006
now that i have 3 text boxes .. when i type numbers then press enter the numbers will be cleared??
and that doesn't happen with 2nd and 3rd number?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: enter key

 
0
  #10
Nov 14th, 2006
Huh?

When you press the enter button on the keyboard you mean.

Do you have any code?
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC