Home > Software engineering >  VB numerical overflow
VB numerical overflow

Time:11-14

In the process of the vb
Private Sub Text19_Click ()
Dim x As Long

If IsNumeric (Text15. Text)=flase Or Text15. Text="" Then Exit Sub
If IsNumeric (Text16. Text)=flase Or Text16. Text="" Then Exit Sub
X=Val Val (Text15. Text) * (Text16. Text) ^ 3/12
Text19. Text=x
End Sub
Show numeric overflow?
Please answer, thank you

CodePudding user response:

See what number you input the first

CodePudding user response:

If IsNumeric (Text15. Text)=flase Or Text15. Text="" Then Exit Sub

It should be
If IsNumeric (Text15. Text)=False Or Text15. Text="" Then Exit Sub

But should use the IF (Not IsNumeric (Text15. Text)) Then the Exit Sub
It is ok

CodePudding user response:

To define the X as double

 
Private Sub Text19_Click ()
Dim x As Double
If IsNumeric (Text15. Text)=False Or Text15. Text="" Then Exit Sub
If IsNumeric (Text16. Text)=False Or Text16. Text="" Then Exit Sub
X=Val Val (Text15. Text) * (Text16. Text) ^ 3/12
Text19. Text=x
End Sub

CodePudding user response:

Well well, ok, thank you very much
  • Related