469,283 Members | 2,349 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

Return Key

I am new to VB.Net and I am developing a stand-alone app
that will only be using a RF scanner to enter
information. I was curious if anyone knew of any articles
or source code on how I could get the text box to execute
to TAB/ENTER when a certain number of characters have been
reached within a text box.
Jul 19 '05 #1
3 3745
Chris,
maybe this code will help you. Place 2 textboxes on the form and write this
code

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Len(TextBox1.Text) >= 5 Then
e.Handled = True
Call Done()
End If
End Sub

Private Sub Done()
TextBox2.Select()
TextBox2.Text = "No more characters. Do something else"
End Sub

You can call any sub or function instead of my DONE sub
Vlad

"Chris" <ch*********@tbgamericas.com> wrote in message
news:00****************************@phx.gbl...
I am new to VB.Net and I am developing a stand-alone app
that will only be using a RF scanner to enter
information. I was curious if anyone knew of any articles
or source code on how I could get the text box to execute
to TAB/ENTER when a certain number of characters have been
reached within a text box.

Jul 19 '05 #2
Will this code recognize when the user presses the ENTER
key?
-----Original Message-----
Chris,
maybe this code will help you. Place 2 textboxes on the form and write thiscode

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e AsSystem.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Len(TextBox1.Text) >= 5 Then
e.Handled = True
Call Done()
End If
End Sub

Private Sub Done()
TextBox2.Select()
TextBox2.Text = "No more characters. Do something else"End Sub

You can call any sub or function instead of my DONE sub
Vlad

"Chris" <ch*********@tbgamericas.com> wrote in message
news:00****************************@phx.gbl...
I am new to VB.Net and I am developing a stand-alone app
that will only be using a RF scanner to enter
information. I was curious if anyone knew of any articles or source code on how I could get the text box to execute to TAB/ENTER when a certain number of characters have been reached within a text box.

.

Jul 19 '05 #3
"Chris" <ch*********@tbgamericas.com> wrote in message
news:00****************************@phx.gbl...
I am new to VB.Net and I am developing a stand-alone app
that will only be using a RF scanner to enter
information. I was curious if anyone knew of any articles
or source code on how I could get the text box to execute
to TAB/ENTER when a certain number of characters have been
reached within a text box.


By doing a "Tab", i'm guessing you mean shifting the focus
to the next textbox. That would be done like this:

Private Sub txtOne_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles txtOne.TextChanged

'where txtOne and txtTwo are two textboxes on the form
If txtOne.Text.Length = 5 Then
txtTwo.Focus()
End If
End Sub

By doing and enter, I presume you want some action(s) to occur
when the box is full. For this, put the action into a sub(eg. MySub)
and call the sub like this:

Private Sub txtTwo_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles txtTwo.TextChanged

If txtOne.Text.Length = 5 Then
Call MySub()
End If
End Sub

Hope this helps,
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Phil Powell | last post: by
25 posts views Thread by cppaddict | last post: by
2 posts views Thread by Rhino | last post: by
10 posts views Thread by Mark Jerde | last post: by
12 posts views Thread by Michael Maes | last post: by
3 posts views Thread by kikazaru | last post: by
KoreyAusTex
6 posts views Thread by KoreyAusTex | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.