Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8
This is the forum to discuss the Wrox book Visual Basic 2008 Programmer's Reference by Rod Stephens; ISBN: 9780470182628
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 27th, 2008, 01:24 AM
Registered User
 
Join Date: Oct 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Enter as a valid entry in a textbox (VB)

I am new to VB2008 and I am stuck. I am creating an automated entry form for a barcode printing program. The goal is to scan (via keyboard wedge type scanner) a barcode label format into a textbox and then have the user press enter (or have the enter keystroke embedded in the scanned barcode). Once the enter has been pressed/scanned I would like to have control of the textbox as I would with the on Click. How do I do this?

Thank you
  #2 (permalink)  
Old February 9th, 2009, 04:33 PM
Authorized User
 
Join Date: Dec 2008
Location: Keyport, NJ 07735
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If e.KeyChar = Chr(13) Then
            MsgBox("Enter was pressed")
            'Now we need to stop the annoying ding
            e.KeyChar = Chr(1)
        End If
    End Sub
If this helps you please use the thanks button.
  #3 (permalink)  
Old February 9th, 2009, 04:37 PM
Authorized User
 
Join Date: Dec 2008
Location: Keyport, NJ 07735
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If Not InStr(TextBox1.Text, Chr(13)) = 0 Then MsgBox("Enter Key was sent to text box")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = "hello" & Chr(13)
    End Sub
If this helps you please use the thanks button.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date entry textbox as / / adamusufi SQL Server 2000 5 February 22nd, 2009 12:23 AM
TextBox entry validation thillai Visual Basic 2005 Basics 6 February 20th, 2008 07:23 AM
force a valid entry befor exiting Vince_421 Access VBA 7 June 22nd, 2006 09:52 AM
enter key on textbox, performs button event code?? squeakstar Visual Basic 2005 Basics 4 June 22nd, 2006 05:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.