Private Sub TextBox1_GotFocus1(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
TextBox1.Text = TextBox1.Tag
SendKeys.Send(“{HOME}+{END}”)
End Sub

Private Sub TextBox1_KeyPress1(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not (e.KeyChar = “.” And InStr(TextBox1.Text, “.”) = 0) Then
If InStr(“0123456789”, e.KeyChar) = 0 And Asc(e.KeyChar) <> 8 Then
e.KeyChar = “”
End If
End If
End Sub
‘Set Textbox Berformat currency
Private Sub TextBox1_LostFocus1(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
TextBox1.Tag = Val(TextBox1.Text)
TextBox1.Text = Format(CDbl(TextBox1.Text), “###,##0.00”)
MsgBox(TextBox1.Text)
End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim xcari_titik = 0
Dim xcari_titik1 = “tidak”
For xcari_titik = 1 To Len(Trim(TextBox1.Text))
If Mid(Me.TextBox1.Text, xcari_titik, 1) = “.” Then
xcari_titik1 = “ada”
Exit For
End If
Next

If Me.TextBox1.Text = “” Or Not IsNumeric(Me.TextBox1.Text) Then

Else
TextBox1.Tag = Me.TextBox1.Text
If xcari_titik1 = “tidak” Then
Me.TextBox1.Text = Format(CDbl(TextBox1.Tag), “#,##0”)
TextBox1.SelectionStart = Len(TextBox1.Text)

End If
End If
End Sub