Solved

submit value in winform using Enter Button

Posted on 2006-07-20
4
395 Views
Last Modified: 2012-05-05
Hi,

am using vb.net  2003, having 1 question on submitting information

i have 1 text box accepting UPC number " 000000000000 " 

1 - i need to validate this input as soon as user press enter ( validation in this case mean no alphabets or any other special character and length must be lets say 12 in this case.)


2 -need to submit this information after validation o lets say SP in sql 2000

i am not sure how i can do all that on enter event .


Regards
SMB

0
Comment
Question by:bsheikh
  • 3
4 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 17146120
use javascript onKeyPress when e=13
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17146121
oops, you can't use javascript with winforms
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17146148
Protected Overrides Sub OnKeyPress(e As KeyPressEventArgs)
 
          If e.KeyChar = CChar(13) Then
 
              ''validate input here
 
          End If
 
     End Sub 'OnKeyPress
 
0
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 100 total points
ID: 17146322
  Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            If Not IsNumeric(TextBox1.Text) AndAlso TextBox1.Text.Length <> 12 Then
                MsgBox("Invalid Entry")
                Exit Sub
            Else
                'Perform SQL Commands here
            End If
        End If
    End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now