un ami m'a conseiller ca, mais cela ne fonctionne pas
Private Sub Command1_Click()
For i = 1 To Len(RichTextBox1) Step 2
If Mid$(RichTextBox1.Text, i, 2) = "59" Then
RichTextBox1.SelStart = i
RichTextBox1.SelLength = 2
ShareVB
Messages postés2676Date d'inscriptionvendredi 28 juin 2002StatutMembreDernière intervention13 janvier 201626 3 janv. 2003 à 08:03
salut
il suffit de remplacer
ton code
par
'les commentaires commentent les erreurs
Private Sub Command1_Click()
Dim i As Long
For i = 1 To Len(RichTextBox1.Text) 'incrementer seulement de 1;spécifier .Text
If Mid$(RichTextBox1.Text, i, 2) = "59" Then
RichTextBox1.SelStart = i - 1
RichTextBox1.SelLength = 2
RichTextBox1.SelColor = vbRed
End If ' ne pas oublier les End If des If...Then en plusieurs lignes
Next
End Sub
cs_alfo
Messages postés3Date d'inscriptionvendredi 27 décembre 2002StatutMembreDernière intervention30 septembre 2004 3 janv. 2003 à 08:13
-------------------------------
Réponse au message :
-------------------------------
> bonjour dans un richtext box jai un text numerique
>
> du genre
>
> 456 456 25 335 845 142674 43 21454 56 24 84
> 84 65 32 51 64 987 5341 87 64 231
> 321 585 2 8 4 685 54 59 357442 59
>
> et je voudrais mettre les chiffres "59" en rouge
>
> un ami m'a conseiller ca, mais cela ne fonctionne pas
>
> Private Sub Command1_Click()
> For i = 1 To Len(RichTextBox1) Step 2
> If Mid$(RichTextBox1.Text, i, 2) = "59" Then
> RichTextBox1.SelStart = i
> RichTextBox1.SelLength = 2
>
> RichTextBox1.SelColor = vbRed
> Next
> End Sub
>
> pouvez vous m'aider svp
>
>
>
> Bonjour, voici la solution à ton problème:
Private Sub Command1_Click()
For i = 1 To Len(RichTextBox1.Text) Step 1
If Mid$(RichTextBox1.Text, i, 2) = "59" Then
RichTextBox1.SelStart = i - 1
RichTextBox1.SelLength = 2
VicoLaChips2
Messages postés436Date d'inscriptiondimanche 20 janvier 2002StatutMembreDernière intervention 2 février 20102 3 janv. 2003 à 14:03
Bonjour -;)
Ben moi j'ai aussi une soluce...
Private Sub Form_Load()
Dim strTmp As String, tblVal() As String, i As Integer
Open "c:\fictest.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, strTmp
tblVal = Split(strTmp, " ")
For i = 0 To UBound(tblVal)
If Trim(tblVal(i)) = "59" Then MsgBox "YA BON LE 59 + 10 !!"
Next
Loop
End Sub
'Bien sur ça ne correspond peut être pas à la réponse idéale... mais bon !!
VicoLaChips2
Messages postés436Date d'inscriptiondimanche 20 janvier 2002StatutMembreDernière intervention 2 février 20102 3 janv. 2003 à 14:12
Euhh.. encore moi !!
Plus sérieusement .
Option Explicit
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To Len(rtf.Text)
If Mid(rtf.Text, i, 2) = "59" Then
MsgBox "Super le 59 + 10 !!"
End If
Next
End Sub
VicoLaChips2
Messages postés436Date d'inscriptiondimanche 20 janvier 2002StatutMembreDernière intervention 2 février 20102 3 janv. 2003 à 14:20
SORRY !!
Option Explicit
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To Len(rtf.Text)
If Mid(rtf.Text, i, 2) = "59" Then
rtf.SelStart = i - 1
rtf.SelLength = 2
rtf.SelColor = vbRed
End If
Next
End Sub
cs_jackky
Messages postés50Date d'inscriptionmardi 8 janvier 2002StatutMembreDernière intervention 6 juillet 2003 3 janv. 2003 à 14:24
wow merci a tous ceux qui ont repondu c vraiment super
je vous remercie beaucoupvous etes bien sympa
en fais je travail sur un projet personnel et puis je voulais decryter se qui pass par le port serie et le message a un bit de start de 59 59 59 59 59 ,
mais ya aussi plusieur chose sur cette frequence c pour cela que je voulais mettre les 59 en rouge,