472,351 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

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 3859
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Powell | last post by:
My first time working with a PHP class, and after 6 hours of working out the kinks I am unable to return a value from the class, so now I appeal to...
20
by: Jakob Bieling | last post by:
Hi! I am using VC++ 7.1 and have a question about return value optimization. Consider the following code: #include <list> #include <string> ...
25
by: cppaddict | last post by:
I'd like to know what goes on under the hood when methods return objects. Eg, I have a simple Point class with two members _x and _y. It's...
2
by: PengYu.UT | last post by:
I have the following sample program, which can convert function object with 1 argument into function object with 2 arguments. It can also do +...
2
by: Rhino | last post by:
I am trying to verify that I correctly understand something I saw in the DB2 Information Center. I am running DB2 Personal Edition V8.2.1 on...
15
by: Greenhorn | last post by:
Hi, when a function doesn't specify a return type ,value what value is returned. In the below programme, the function sample()is returning the...
10
by: Mark Jerde | last post by:
I'm trying to learn the very basics of using an unmanaged C++ DLL from C#. This morning I thought I was getting somewhere, successfully getting back...
12
by: Michael Maes | last post by:
Hello, I have a BaseClass and many Classes which all inherit (directly) from the BaseClass. One of the functions in the BaseClass is to...
3
by: kikazaru | last post by:
Is it possible to return covariant types for virtual methods inherited from a base class using virtual inheritance? I've constructed an example...
6
KoreyAusTex
by: KoreyAusTex | last post by:
If anyone can help me figure out the what the missing return statements are, I think it might be the fact that I need to add a return false in the...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.