Click here to Skip to main content
16,005,281 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralTransparencyKey usage consuming memory Pin
gregcost13-Dec-03 6:56
gregcost13-Dec-03 6:56 
QuestionHow to declare a public variable that can be edit by forms?VB.Net Pin
MJay13-Dec-03 5:10
MJay13-Dec-03 5:10 
QuestionHow to Draw 3D charts Pin
xprtguro13-Dec-03 2:40
xprtguro13-Dec-03 2:40 
QuestionHow to check the data type of user input?VB.Net Pin
MJay13-Dec-03 2:23
MJay13-Dec-03 2:23 
AnswerRe: How to check the data type of user input?VB.Net Pin
Colin Angus Mackay13-Dec-03 2:57
Colin Angus Mackay13-Dec-03 2:57 
GeneralRe: How to check the data type of user input?VB.Net Pin
MJay13-Dec-03 6:44
MJay13-Dec-03 6:44 
GeneralRe: How to check the data type of user input?VB.Net Pin
Colin Angus Mackay13-Dec-03 7:02
Colin Angus Mackay13-Dec-03 7:02 
AnswerRe: How to check the data type of user input?VB.Net Pin
Charlie Williams13-Dec-03 9:35
Charlie Williams13-Dec-03 9:35 
One way to validate user input is using regular expressions. Regexes can get pretty complicated if you need them to do more advanced validation, but simple things like making sure only numbers are input are simple enough.



This test looks for the beginning of a line, followed by one or more numbers, followed by the end of the line:

Imports System.Text.RegularExpressions
<br />
Dim re as new Regex("^\d+$")<br />
If re.IsMatch(myTextBox.Text) Then<br />
  'Input passed the test<br />
Else<br />
  'Failed<br />
End If<br />


To accept only non-numbers: "^\D+$"
To accept only strings in the format 123A: "^[\d]{3}[A-Z]$"

There are more variations than you can shake a stick at. You could, for example, make sure input is in the format of a US social security number or a phone number or a URL or whatever else you can think of.



Charlie

Here I am. Love me.
GeneralRe: How to check the data type of user input?VB.Net Pin
MJay13-Dec-03 21:44
MJay13-Dec-03 21:44 
GeneralRe: How to check the data type of user input?VB.Net Pin
Charlie Williams14-Dec-03 8:28
Charlie Williams14-Dec-03 8:28 
QuestionHow to disable item editing in combobox?vb.Net Pin
MJay13-Dec-03 2:19
MJay13-Dec-03 2:19 
AnswerRe: How to disable item editing in combobox?vb.Net Pin
Colin Angus Mackay13-Dec-03 3:12
Colin Angus Mackay13-Dec-03 3:12 
GeneralRe: How to disable item editing in combobox?vb.Net Pin
MJay13-Dec-03 6:07
MJay13-Dec-03 6:07 
GeneralRe: How to disable item editing in combobox?vb.Net Pin
Colin Angus Mackay13-Dec-03 6:16
Colin Angus Mackay13-Dec-03 6:16 
GeneralRe: How to disable item editing in combobox?vb.Net Pin
MJay13-Dec-03 21:49
MJay13-Dec-03 21:49 
GeneralPassing variable between parent/child forms Pin
MadCow12-Dec-03 16:00
MadCow12-Dec-03 16:00 
GeneralRe: Passing variable between parent/child forms Pin
Colin Angus Mackay13-Dec-03 2:47
Colin Angus Mackay13-Dec-03 2:47 
GeneralRe: Passing variable between parent/child forms Pin
MadCow13-Dec-03 13:58
MadCow13-Dec-03 13:58 
GeneralRe: Passing variable between parent/child forms Pin
Colin Angus Mackay13-Dec-03 14:50
Colin Angus Mackay13-Dec-03 14:50 
GeneralRe: Passing variable between parent/child forms Pin
MadCow14-Dec-03 10:56
MadCow14-Dec-03 10:56 
Generaldetermining drive free space on remote machine Pin
findneville12-Dec-03 8:24
findneville12-Dec-03 8:24 
GeneralRe: determining drive free space on remote machine Pin
Dave Kreskowiak12-Dec-03 8:28
mveDave Kreskowiak12-Dec-03 8:28 
Questionhow to add checkbox or radio button to a specific column of listview? Pin
Tridip Bhattacharjee12-Dec-03 1:19
professionalTridip Bhattacharjee12-Dec-03 1:19 
Questionwhat is .htc file and tell me the use ? Pin
Tridip Bhattacharjee12-Dec-03 1:15
professionalTridip Bhattacharjee12-Dec-03 1:15 
Questionwhat is com+ and what is difference between com and com+ Pin
Tridip Bhattacharjee12-Dec-03 1:10
professionalTridip Bhattacharjee12-Dec-03 1:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.