Public Class Accueil Private n As Integer = 0 Private Sub RTB_KeyDown(sender As Object, e As KeyEventArgs) Handles RTB.KeyDown n = n + 1 : If n > 3 Then e.SuppressKeyPress = True End Sub End Class
Option Strict On Option Explicit On Imports ImageSur_Form Imports Microsoft.Office.Interop Imports Microsoft.Office.Interop.Word Public Class Form1 Dim oWord As New Word.Apllication Dim n As Integer =0 Private Sub RichTextBox1_KeyDown(Byval sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles RichTextBox1.KeyDown n = n+1 : If n>15 Then e.SuppressKeyPress = True End Sub End Class
Handles RichTextBox1.KeyDown
e.SuppressKeyPress
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub RichTextBox1_KeyPress(Byval sender As System.Object, _ e As System.Windows.Forms.KeyPressEventArgs) Handles RichTextBox1.KeyPress If Len(RichTextBox1.Text)>RichTextBox1.MaxLenght then MSgbox("Oups") End If End Sub
If Len(RichTextBox1.Text)>RichTextBox1.MaxLenghtNe peut jamais être vrai.. puisque tu ne peux pas taper plus de caractères que le MaxLength..
If Len(RichTextBox1.Text)=RichTextBox1.MaxLenght then MSgbox("Oups")
private flagmax as boolean = false
Private Sub RichTextBox1_KeyPress(Byval sender As System.Object, _
e As System.Windows.Forms.KeyPressEventArgs) Handles RichTextBox1.KeyPress
if flagmax then
messagebox.show("new rtb")
exit sub
end if
If (RichTextBox1.Text).lenght = RichTextBox1.MaxLenght then
flagmax = true
else
flagmax = false
End If
End Sub
If (RichTextBox1.Text).lenght = RichTextBox1.MaxLenght then RichTextBox2.Focus() end if
Private Sub RichTextBox1_KeyPress(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles RichTextBox1.KeyPress
If RichTextBox1.Text.Length = RichTextBox1.MaxLength Then
RichTextBox2.Focus()
End If
End Sub
Private Sub RichTextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyUp
If RichTextBox1.Text.Length = RichTextBox1.MaxLength Then
RichTextBox2.Focus()
End If
End Sub