By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 987 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

Return Key

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
"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.