Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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 December 13th, 2004, 09:16 AM
Registered User
 
Join Date: Dec 2004
Location: lahore, punjab, Pakistan.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Integer Check

hi,
  As you must have guessed i am new to VB.Net.All iwanted to ask you is that i want to put the check on integer e.g if user passed "awais" then he shouldnt pass 123 with it.Means he shouldnt pass "awais123".I can put the check on simple Integer value but if passed together with string .How can i chekc it.
Thanks
  #2 (permalink)  
Old December 13th, 2004, 10:01 PM
Authorized User
 
Join Date: Oct 2003
Location: , , New Zealand.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not too sure I understand your question(s).

To perform a simple check to verify whether a textbox contains ALL integers use:

Dim check As String = TextBox1.Text
If IsNumeric(check) Then
            'code here
End If

If the user is entering a fixed format ID number or something like that and you wanted to check whether the last three characters were integers, you might use the substring property:

Dim check As String = TextBox1.Text
If IsNumeric(check.Substring(check.Length - 3, 3)) Then
            'code here
End If

This code would check the last three characters of the textbox were integers.
  #3 (permalink)  
Old December 18th, 2004, 02:04 AM
Registered User
 
Join Date: Dec 2004
Location: lahore, punjab, Pakistan.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
   Thanks alot.The substring method has helped me solved my problem.thanks again.
  awais


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check programmatically check the password? thomaskelly ASP.NET 1.0 and 1.1 Basics 1 May 16th, 2008 08:49 PM
Connect to VSS check-in Check-out Programatically rhd110 General .NET 6 August 12th, 2007 07:46 AM
Help 'Check ListView' vs 'Check ListBox' MikeY C# 1 February 24th, 2005 02:20 PM
Have any function to check the integer type only calvinpost ASP.NET 1.x and 2.0 Application Design 2 April 1st, 2004 01:05 AM





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