Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

submit value in winform using Enter Button

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
write xml in vb.net 2 32
Generate Numbers in JQuery file 11 66
Help with error in Query 2 31
VB.Net Determine if a mapped network drive exists 2 30
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

839 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