Recherche Paragraphe

avril - 31 juil. 2017 à 10:41
LaluneBe Messages postés 7 Date d'inscription vendredi 29 septembre 2017 Statut Membre Dernière intervention 11 octobre 2017 - 10 oct. 2017 à 15:01
Bonjour,
J'ai une application d'éditeur de texte en vb6, le problème que je n'arrive pas à compter les paragraphes dans les Richtextbox

1 réponse

LaluneBe Messages postés 7 Date d'inscription vendredi 29 septembre 2017 Statut Membre Dernière intervention 11 octobre 2017
10 oct. 2017 à 15:01
Bonjour,
1) Créer un bouton et mettre le code suivant dans le bouton:
Private Sub Command1_Click()
Dim i, position, nbParagraph As Integer
position = 1
nbParagraph=0
For i = 1 To Len(RichTextBox1.Text)
Paragraph = InStr(position, Form1.RichTextBox1.Text, vbLf)
If Paragraph > 0 Then
nbParagraph=nbParagraph+1
Text1.text= nbParagraphe
else
goto fin
end if
position = Paragraph + 1
Next i
fin:
End sud
0
Rejoignez-nous