allora, ho un pò risolto così
ma resta il problema che il contatore aumenta ance se premo un tasto tipo freccette, invio o concello una parte di testo...
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
Dim MaxLenght As Integer
Dim TestoAttuale As String
TestoAttuale = Text2.Text
MaxLenght = 10
DinLenght = DinLenght + 1
If DinLenght > MaxLenght Then
Text2.Text = TestoAttuale & vbCrLf
DinLenght = 0
Text2.SelStart = Len(Text2.Text)
End If
End Sub
EDIT:
dimenticavo, in realtà non va bene nemmeno con questo ecento keydown ne tanto meno keypress
in quanto spesso non è realmente l'utente ad inserire il testo manualmente
ma una procedura che popola quella TextBox, in quest'ultimo caso il testo non verrà riportato a capo ogni 10 caratteri.
avete suggerimenti ?
Grazie ancora![]()