Selction d'une chaine dans un controle text

cs_amiro Messages postés 48 Date d'inscription samedi 1 mai 2004 Statut Membre Dernière intervention 8 mai 2005 - 25 déc. 2004 à 14:59
cs_amiro Messages postés 48 Date d'inscription samedi 1 mai 2004 Statut Membre Dernière intervention 8 mai 2005 - 10 janv. 2005 à 15:55
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(ReyTextBox1.Text, Search)
' S'il la trouve,
If Where Then
' définit le début de la sélection
ReyTextBox1.SelStart = Where - 1
' et définit sa longueur.
ReyTextBox1.SelLength = Len(Search)
Else
' Informe l'utilisateur.
MsgBox "Chaîne introuvable."
End If
End Sub
j'ai utliser ce code que j'ai trouvé dans la collection de mSDN.
ce programme permet la sélectionne d'un champ mais malheureusement ça marche pascomment faire pour que ça marche correctement
ezzi

2 réponses

Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
25 déc. 2004 à 15:51
en lui donnant le focus:

ReyTextBox1.SetFocus

Daniel
0
cs_amiro Messages postés 48 Date d'inscription samedi 1 mai 2004 Statut Membre Dernière intervention 8 mai 2005
10 janv. 2005 à 15:55
ça marche pas encore

ezzi
0
Rejoignez-nous