943,553 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 55315
  • VB.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
Nov 8th, 2006
0

enter key

Expand Post »
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..
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vb_learner is offline Offline
13 posts
since Nov 2006
Nov 9th, 2006
-1

Re: enter key

or you could just use the mouse and position the cursor in which ever text box you want?
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Nov 9th, 2006
0

Re: enter key

Try this:
VB.NET Syntax (Toggle Plain Text)
  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.
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002
Nov 10th, 2006
0

Re: enter key

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 : )
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vb_learner is offline Offline
13 posts
since Nov 2006
Nov 10th, 2006
0

Re: enter key

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.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Nov 10th, 2006
0

Re: enter key

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. .
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vb_learner is offline Offline
13 posts
since Nov 2006
Nov 10th, 2006
0

Re: enter key

Click to Expand / Collapse  Quote originally posted by vb_learner ...
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.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Nov 10th, 2006
0

Re: enter key

see attachment
Attached Thumbnails
Click image for larger version

Name:	crap.GIF
Views:	1875
Size:	25.0 KB
ID:	2522  
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Nov 14th, 2006
0

Re: enter key

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vb_learner is offline Offline
13 posts
since Nov 2006
Nov 14th, 2006
0

Re: enter key

Huh?

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

Do you have any code?
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in VB.NET Forum Timeline: System Usage Administration - Internet cafe management
Next Thread in VB.NET Forum Timeline: Compare 2 Tables - Return Rows VB 2008





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC