Torna al Thread
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
' se non c'è scritto niente nella textbox, metto uno zero
If TextBox1.TextLength = 0 Then
TextBox1.Text = "0"
End If
Dim str As String = TextBox1.Text ' contenuto casella di testo
str = str.Replace(",", "") ' ripulisco il tutto dalle virgole
Dim L As Integer = str.Length ' lunghezza testo
If (L > 3) Then ' abbiamo più di 3 caratteri?
str = str.Insert(L - 3, ",")
L = L - 3
While (L > 3)
str = str.Insert(L - 3, ",")
L = L - 3
End While
End If
TextBox1.Text = str
TextBox1.SelectionStart = str.Length
End Sub