levshkatov
levshkatov

Reputation: 477

Type mismatch with Single type of data

I need to use Single type of data but I have an error if I enter . or -: Type mismatch

Private Sub TextBox1_Change()
Call inputPotential(TextBox1.Value)
End Sub
Private Function inputPotential(ByRef inputValueSingle As Single)
End Function

What is the problem and how to solve it?

Thanks a lot!

Upvotes: 1

Views: 73

Answers (1)

Dirk Reichel
Dirk Reichel

Reputation: 7979

Change

Call inputPotential(TextBox1.Value)

to

If IsNumeric(TextBox1.Value) Then Call inputPotential(TextBox1.Value)

having only a - or . isnt a single-type number -> counts as string :)

Upvotes: 1

Related Questions