Ok I have written a calculation form using textboxes as the sngvalue inputs everything works fine so no problems here, but I have tried countless methods to register when the decimal point has been entered or deleted from the textbox, as adding another decimal point raises an error, I am trying to limit the decimal to just 1 ie "." in any textbox which by the way can appear anywhere in the syngvalue.

Anyone out there with a tad of info would be recieved with Joy which, by the way is an emotion of great hapiness..........

Recommended Answers

All 4 Replies

You can try Masked Edit Control instead of TextBox control

Or you could try the KeyPress event and count the number of decimal points.

try the lostfocus event then format the value like i.e.

Private Sub Text1_LostFocus()
    Text1.Text = Format(Val(Text1.Text), "######0.00")
End Sub

Thanks for the response seems my code was going all around the garden without going through the gate.

Many thanks to Jirehs pointers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.