è possibile creare una richtextbox(o qualche altro controllo magari) che possa avere al massimo 2 righe di testo?
ad esempio se scrivo il testo:
e possibile che in qualche modo il tasto invio venga disattivato o qualcosa del genere?
ho provato ad usare una textbox... xke sarebbe stato più facile controllare il tasto "invio" di ritorno a capo.... ma nelle textbox anche se inserisco "chr(13)", non va a capo, ma crea un carattere strano.
il codice che ho provato con la textbox è questo:
codice:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Sel = Text1.SelStart
Text1.SelStart = 0
Text1.SelLength = Len(Left(Text1.Text, Sel))
txt1 = Text1.SelText
Text1.SelStart = Sel
Text1.SelLength = Len(Right(Text1.Text, Sel))
txt2 = Text1.SelText
Text1.Text = txt1 & Chr(13) & txt2
Text1.SelStart = Sel + 1
End If
End Sub