hi,
i am able to validate decimal input with TextBox. I used the following codings so that only 2 numbers are allowed aftr decimal.also, only 1 decimal is allowed in a textbox.
VB Code:
Option Explicit Dim k, s, c Private Sub Text1_Change() If Len(Text1.Text) = s Then Command1.SetFocus End If End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) k = Chr(KeyAscii) Like "[0-9]" If KeyAscii = 46 And c >= 1 Then KeyAscii = 0 End If If KeyAscii = 46 Then s = Len(Text1.Text) + 3 c = c + 1 End If End Sub
the problem arises when i use backspace.i am unable to type Decimal point again.
hw shud i track whether decimal point is being erased or not.so that aftr typing decimal point for second time{(ie)aftr erasing first one using backspace},only 2 digits are allowed aftr it.![]()
plzzzz help me solve this.




Preethi. 
Reply With Quote