Private Sub Form_Load()
Text1.Text = "0.00"
End Sub
Private Sub Text1_Change()
Text1.SelStart = Len(Text1.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then
If Text1.Text = "0.00" Then
Label1.Caption = "0.00"
Else
If Text1.Text = "0.000" Then
Text1.Text = "0.00"
Else
c = Len(Text1.Text)
If c < 6 Then
If Left(Text1.Text, 2) = "0." Then
If Left(Text1.Text, 3) = "0.0" Then
If Left(Text1.Text, 4) = "0.00" Then
Text1.Text = "0.0" & Right(Text1.Text, 1)
Else
Text1.Text = "0." & Right(Text1.Text, 2)
End If
Else
Label2.Caption = Text1.Text
Label3.Caption = c
Text1.Text = Mid(Text1.Text, c - 2, 1) & "." & Right(Text1.Text, 2)
End If
Else
Text1.Text = Left(Text1.Text, 1) & Mid(Text1.Text, c - 2, 1) & "." & Right(Text1.Text, 2)
End If
Else
Text1.Text = Left(Text1.Text, c - 4) & Mid(Text1.Text, c - 2, 1) & "." & Right(Text1.Text, 2)
End If
End If
End If
Else
End If
End Sub