Search Tools Links Login

Floating Point Numbers Validation

Posted: 2019-08-25
By: RajuV
Viewed: 268

Filed Under:

VB6 Miscellaneous, VB6 String Handling, VB6 Code Cache

Title Uploaded Size 8/25/2019 2:50:02 PM 1,329

Just like the title says, the code in the attached file will validate the floating point numbers in a text box.


Create a form with a textbox, and insert the following into the form code:

Private Sub Form_Load()

   Text1.Text = Empty

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

   ' Precision is 2 in this case
   ' Send the Precision Value same in both the Functions
   Call ValidateNum(Text1, 2, KeyAscii)

End Sub

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)

   Call ValidateDel(Text1, 2, KeyCode)

End Sub

Special Instructions

This code originally appeared on, and has been republished here with the permission of Andrea Tincani.

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.