473,385 Members | 1,392 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Validations in VB

Can anybody tell me if there is any option to validate data in textbox in tollbox or we have write a code for it..if so plz pass me a sample snippet of code

Thanks in advance
Feb 15 '07 #1
2 1016
willakawill
1,646 1GB
Hi. There is no real sample of validation, just an approach.
Write it out in english
break it down into the smallest parts you can
code each part.

as an example:
I want this textbox to contain at least 6 characters
the content of this textbox, excluding any white space, must exceed 5 characters.
read the content of the textbox
remove whitespace
check the length
if it is greater than 5 carry on
otherwise keep the focus at this texbox and issue an error messagebox.

Expand|Select|Wrap|Line Numbers
  1. Dim stInput As String
  2.  
  3. stInput = Trim(TextBox1.Text)
  4. If Len(stInput) < 6 Then
  5.    MsgBox "Input must be 6 characters or more"
  6.    TextBox1.SetFocus
  7. End If
Feb 17 '07 #2
Hi. There is no real sample of validation, just an approach.
Write it out in english
break it down into the smallest parts you can
code each part.

as an example:
I want this textbox to contain at least 6 characters
the content of this textbox, excluding any white space, must exceed 5 characters.
read the content of the textbox
remove whitespace
check the length
if it is greater than 5 carry on
otherwise keep the focus at this texbox and issue an error messagebox.

Expand|Select|Wrap|Line Numbers
  1. Dim stInput As String
  2.  
  3. stInput = Trim(TextBox1.Text)
  4. If Len(stInput) < 6 Then
  5.    MsgBox "Input must be 6 characters or more"
  6.    TextBox1.SetFocus
  7. End If
i f is date(textbx1.text) then
msgbox("your date i s correct")
else
msgbox(" pls enter date value only")
end if
Feb 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Naresh Agarwal | last post by:
Hi I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing. I want to perform schema validations on the xml. The problem is that root element of XML document does not have...
0
by: babash | last post by:
I designed a site with asp.net all pages are working properly on my local computer but when I upload the sit on the server on those pages that I have field validation, Buttons doesn’t work. When...
19
by: Gérard Talbot | last post by:
posted to: alt.html and comp.infosystems.www.authoring.html followup-to: comp.infosystems.www.authoring.html Hello all, I have 2 questions about validations. 1- What's basically the...
0
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
1
by: DotNetJunkies User | last post by:
I successfully implemented this poup calendar control in C#. But the problem I am having is that the button click is posting back and the validator is getting fired which is asking all the required...
1
by: Murat YILMAZ | last post by:
Hi all, I have develop a web page and there are 4 textbox on it. I have put 4 validation for these. Issue is that If I have request this page and submit form validations are not working. But I...
1
by: anil kumar via .NET 247 | last post by:
(Type your message here) hi, i am using save & cancel webform buttons in my webpage to withsome validations , when i am trying to save my content it issaved that time i need a popup msg like ur...
1
by: Anup | last post by:
In my form I and doing validations using 'Javascript' as I m using ASP1.1 and there is very less support for Validators there. //Code Behind private void Page_Load(object sender,...
2
by: prakashsurya | last post by:
Hello I am going through the validations in a form I would like to know the validations to be considered in writing javascript for email id so would u plz help me in writing the necessary...
2
by: swethak | last post by:
hi , i write the code in .htm file. It is in cgi-bin/searches/one.htm.In that i write a form submitting and validations.But validations are not worked in that .htm file. I used the same code in my...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.