Solved

submit value in winform using Enter Button

Posted on 2006-07-20
4
394 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

18 Experts available now in Live!

Get 1:1 Help Now