-
Aug 31st, 2015, 01:15 PM
#1
Thread Starter
New Member
Compare Textbox values
I have to textboxes that I want to compare so I can have a message box alert the user to incorrectly entered values.
I can't seem to get the compare to work.
textbox1 > textbox2
This is what I have:
Dim NTGvar, NTPvar As Variant
NTGvar = textbox1
NTPvar = textbox2
If NTGvar > NTPvar Then
MsgBox "Number of Gear teeth can not be less than teeth in Pinion", vbInformation + vbOKOnly, "Number of Teeth Error"
Thanks for the assist
David
-
Aug 31st, 2015, 02:52 PM
#2
Re: Compare Textbox values
Convert string to numeric, Val function is not supported in VBScript, so you can use CInt or CDbl function
Code:
Dim NTGvar, NTPvar
NTGvar = CDbl(textbox1)
NTPvar = CDbl(textbox2)
If NTGvar > NTPvar Then
MsgBox "Number of Gear teeth can not be less than teeth in Pinion", vbInformation + vbOKOnly, "Number of Teeth Error"
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|