1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
Option Explicit
Private Sub cmdQuitter_Click()
End
End Sub
Private Sub cmdRechercher_Click()
Dim strMot As String
Dim intMot As Integer
Dim intPos As Integer
strMot = Me.lblTexte.Caption
intPos = 0
intMot = -1
'Pour annuler le dernier incrément du compteur
If strMot <> "" And txtRecherche.Text <> "" Then
Do
intPos = InStr(intPos + 1, strMot, txtRecherche.Text)
intMot = intMot + 1
Loop Until intPos = 0
txtOccurence = CStr(intMot)
Else
MsgBox "La chaîne ne peut être vide.", vbInformation, "Comptage des mots."
End If
End Sub |
Partager