marty14
Messages postés104Date d'inscriptionlundi 21 août 2006StatutMembreDernière intervention29 mai 2011
-
28 juin 2009 à 16:01
marty14
Messages postés104Date d'inscriptionlundi 21 août 2006StatutMembreDernière intervention29 mai 2011
-
29 juin 2009 à 19:36
marty14
Messages postés104Date d'inscriptionlundi 21 août 2006StatutMembreDernière intervention29 mai 2011 28 juin 2009 à 16:15
Je reponds a mon post:
j'avait donc fait n'importe quoi etcette fois ci ca marche:
posTxt2 = InStr(pos1 + 1, Text11.Text, "14 partants") Or InStr(pos1 + 1, Text11.Text, "15 partants") Or InStr(pos1 + 1, Text11.Text, "16 partants") Or InStr(pos1 + 1, Text11.Text, "17 partants") Or InStr(pos1 + 1, Text11.Text, "18 partants") Or InStr(pos1 + 1, Text11.Text, "19 partants") Or InStr(pos1 + 1, Text11.Text, "20 partants")
posTxt3 = InStr(pos1 + 1, Text11.Text, "1,6") Or InStr(pos1 + 1, Text11.Text, "1,5") Or InStr(pos1 + 1, Text11.Text, "1,4") Or InStr(pos1 + 1, Text11.Text, "1,3") Or InStr(pos1 + 1, Text11.Text, "1,2") Or InStr(pos1 + 1, Text11.Text, "1,21")
If (posTxt2 And posTxt3 > pos1) And (posTxt2 And posTxt3 < pos2) Then MsgBox "bidul bien trouvé dans la partie voulue, à la position " & CStr(posTxt1)
J'imagine que l'on peut faire plus simple, mais bon je debute !!
Private Function
MyMid(
ByRef
Expression
As String
, sLeft
As String
, sRight
As String
,
Optional
Start
As Long
=
1
)
As
String
Dim lPosL As Long, lPosR As Long
lPosL = InStr(Start, Expression, sLeft): lPosR = InStr(lPosL + 1, Expression,
sRight)
If lPosL > 0 And lPosR > 0 Then
MyMid = Mid$(Expression, lPosL + Len(sLeft), lPosR - lPosL - Len(sLeft))
Else
MyMid = vbNullString
End If
End Function
'EXEMPLE D'UTILISATION
Private Sub Form_Load()
Dim sStr As String
MsgBox MyMid("
machin
", "'>", "</")
Unload Me
End Sub
Et je ne sais pas comment programmer pour faire en sorte que si TEXTBOX1 contient
"16 partants" ou "15 partants" ET "1,5" ou "1,4" = beep par exemple
j'ai essayé ceci mais sans succes, il beep parceque 14 partants existe seulement
meme si 1,4 ou 1,5 est absent.
Dans le sens inverse ca marche pas, il ne beep pas si 1,4 existe :
If InStr(1, Text11.Text, (" 14 partants ")) Or InStr(1, Text11.Text, (" 15 partants ")) And InStr(1, Text11.Text, (" 1,4 ")) Or InStr(1, Text11.Text, (" 1,5 ")) Then
beep
End If
Merci de votre aide
Vous n’avez pas trouvé la réponse que vous recherchez ?
marty14
Messages postés104Date d'inscriptionlundi 21 août 2006StatutMembreDernière intervention29 mai 2011 29 juin 2009 à 16:17
M'sieur PCPT si je peux faire appel une fois de plus a votre savoir.
Voila grace a toi une partie de mon code qui fonctionne trés bien :
y = InStr(1, gg, "Réunion 1")
Z = InStr(1, gg, "Météo :")
Form1.Label4.Caption = Mid(gg, y, Z - (y))
S = InStr(1, gg, "Course 1 :") 'on chope l'emplacement de ça
P = InStr(1, gg, "Course 2 :") 'on chope l'emplacement de ça
If P False Then P InStr(i + 1, gg, "Réunion 2")
Form1.Text11.Text = Mid(gg, S, P - (S + 5))
Il existe plusieur REUNION et donc pour la capture de la 1 ER tous va bien mais dés que l'on passe a la réunion 2 ca ne passe plus.
Aurais tu une idée ?
Merci d'avance