Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

prevent null entries in textbox 1

Status
Not open for further replies.

bryman

Programmer
Oct 3, 2001
9
0
0
US
Help, I need to caluculate values, but if the entry is blank I get an error. What is the best effective way to pervent blank entries or calulations to not bomb if error
 
Hi Bryman,

I hope you use VB6.0 because this isn't working in 5.0
I use the validate event of a textbox to do what you are asking.
Try this

Private Sub Text1_Validate(Cancel As Boolean)
If Not IsNumeric(Text1) Then
MsgBox "Enter a numeric value please",vbExclamation
Cancel = True
End If
End Sub

I suppose the values that must be entered in the textbox must be numeric if you want to do calculations with them.
So this code works fine with both of the problems, numeric and empty.

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top