CIao ho una classe che gestisce una textBox mia molto particolare.
Nell' evento validating (mentre viene validata la textBox) ho questo codice :
codice:
Private Sub TextBox1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
If Me.txtValidate Then
If ErrProv.GetError(TextBox1) = "" Then
e.Cancel = False
Else
e.Cancel = True
End If
End If
End Sub
Va benissimo ma se aggiungo questa cosa :
codice:
... ...
If Me.txtValidate Then
If ErrProv.GetError(TextBox1) = "" Then
e.Cancel = False
textbox1.text = String.format("{0:N2}",textbox1.text)
La formattazione avviene senza eccezioni ma il problema é che non si sposta il focus ...
In pratica mi resta il focus su quella textBox, credo perché assegno un nuovo valore alla proprietà text ..
Soluzioni?