- Private Sub Command1_Click()
- res = vbNullString
- txt = LCase(Text1.Text)
- mot = LCase(Text2.Text)
- Dim MyTab() As String
- MyTab = Split(txt, " ")
-
- For i = 0 To UBound(MyTab)
- If MyTab(i) = mot Then
- For a = 0 To i - 1
- res = res & MyTab(a) & " "
- Next a
-
- For x = i + 1 To UBound(MyTab)
- res = res & MyTab(x) & " "
- Next x
-
- End If
- Next i
-
- Text3.Text = res
- If res = vbNullString Then MsgBox "Cette phrase ne contient pas ce mot !", vbCritical, "Mot introuvable"
-
- End Sub
Private Sub Command1_Click()
res = vbNullString
txt = LCase(Text1.Text)
mot = LCase(Text2.Text)
Dim MyTab() As String
MyTab = Split(txt, " ")
For i = 0 To UBound(MyTab)
If MyTab(i) = mot Then
For a = 0 To i - 1
res = res & MyTab(a) & " "
Next a
For x = i + 1 To UBound(MyTab)
res = res & MyTab(x) & " "
Next x
End If
Next i
Text3.Text = res
If res = vbNullString Then MsgBox "Cette phrase ne contient pas ce mot !", vbCritical, "Mot introuvable"
End Sub