JockVSJock
Technical User
New to VB, and I've created a form that has ten entry
fields that I only want to accept numbers. If text is entered, a message box pops up, and shifts the focus to the field where the error occured.
I don't think the way I have it setup is correct.
dbltxt10 = Val(txt10.Text)
dbltxt9 = Val(txt9.Text)
dbltxt8 = Val(txt8.Text)
dbltxt7 = Val(txt7.Text)
dbltxt6 = Val(txt6.Text)
dbltxt5 = Val(txt5.Text)
dbltxt4 = Val(txt4.Text)
dbltxt3 = Val(txt3.Text)
dbltxt2 = Val(txt2.Text)
dbltxt1 = Val(txt1.Text)
'Data check and do the math
'with an error message output if
'data entered is not numeric
If Not IsNumeric(txt1.Text) Then
MsgBox "Etner Only Numeric Data!!!", vbCritical, "Error!!!!"
I'm repeating this for all of the ten fields. Do I need to have dbltxt1, instead of txt1.Text? Or is this even setup right? The book that I have doesn't provide a good example, and I haven't found any so far on the internet.
thanks