cs_ITALIA
Messages postés2169Date d'inscriptionvendredi 20 avril 2001StatutMembreDernière intervention30 juin 20099 7 sept. 2004 à 14:01
Private Sub Form_Load ()
Text1.Text = "Les deux grands plaisirs des êtres humains sont la bonne chair et la musique classique."
End Sub
Private Sub Form_Click ()
' Déclare les variables.
Dim Search, Where
' Obtient la chaîne à rechercher de l'utilisateur.
Search = InputBox("Tapez le texte à rechercher:")
' Recherche la chaîne dans le texte.
Where = InStr(Text1.Text, Search)
' S'il la trouve,
If Where Then
' définit le début de la sélection
Text1.SelStart = Where - 1
' et définit sa longueur.
Text1.SelLength = Len(Search)
Else
' Informe l'utilisateur.
MsgBox "Chaîne introuvable."
End If
End Sub