Longueur d'un textBox

Résolu
asoaomar Messages postés 28 Date d'inscription mercredi 21 mars 2007 Statut Membre Dernière intervention 19 novembre 2009 - 17 mai 2007 à 21:12
asoaomar Messages postés 28 Date d'inscription mercredi 21 mars 2007 Statut Membre Dernière intervention 19 novembre 2009 - 17 mai 2007 à 23:31
Salut
comment je peut savoir la longueur d'un textBox (nombre de caracteres)?
merci...

7 réponses

cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
17 mai 2007 à 21:14
Avec l'intruction Len(Text1.Text)

---- Sevyc64  (alias Casy) ----<hr size="2" width="100%" /># LE PARTAGE EST NOTRE FORCE #
3
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
17 mai 2007 à 22:46
Salut,
ou en utilisant d'autres trucs

Private Sub Form_Load()
    Text1.Text = "ABCDEFGHIJKLM"
End Sub

Private Sub Command1_Click()
    SupprimeCaractere 5
End Sub

Private Function SupprimeCaractere(pos As Integer)
    If pos < 1 Or pos > Len(Text1.Text) Then Exit Function
    Text1.SelStart = pos - 1
    Text1.SelLength = 1
    Text1.SelText = ""
End Function

Daniel
3
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
17 mai 2007 à 23:23
Re,
je sais pas pourquoi j'ai fais une fonction, une sub suffit, oups !
pour me corriger, je rajoute une longueur
supprimer n caractères à partir de telle position

Private Sub Form_Load()
    Text1.Text = "ABCDEFGHIJKLM"
End Sub

Private Sub Command1_Click()
    SupprimeCaractere 5, 3
End Sub

Private Sub SupprimeCaractere(pos As Integer, Lg As Integer)
    If pos < 1 Or pos > Len(Text1.Text) Then Exit Sub
    If pos + Lg - 1 > Len(Text1.Text) Then Lg = Len(Text1.Text)
    Text1.SelStart = pos - 1
    Text1.SelLength = Lg
    Text1.SelText = ""
End Sub

Daniel
3
asoaomar Messages postés 28 Date d'inscription mercredi 21 mars 2007 Statut Membre Dernière intervention 19 novembre 2009
17 mai 2007 à 21:32
Merci casy de votre aide
est ce que je peut supprimer quelque caracteres d'un textBox a partir d'une position choisit?
Merci...
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
jmfmarques Messages postés 7666 Date d'inscription samedi 5 novembre 2005 Statut Membre Dernière intervention 22 août 2014 27
17 mai 2007 à 21:42
Bonjour,
Regarde du côté des inctuctions Instr et Mid (dans ton aide VB)
Reviens si tu as une difficulté, en précisant laquelle.
0
asoaomar Messages postés 28 Date d'inscription mercredi 21 mars 2007 Statut Membre Dernière intervention 19 novembre 2009
17 mai 2007 à 23:14
Merci Gobillot Daniel
votre exemple est vraiment intéressent 
Merci …
0
asoaomar Messages postés 28 Date d'inscription mercredi 21 mars 2007 Statut Membre Dernière intervention 19 novembre 2009
17 mai 2007 à 23:31
Merci de nouveau.
0
Rejoignez-nous