Per il codice di esempio che ho postato funzionano le tue correzioni, adesso devo applicarlo al mio caso reale, che,per me, è più rompi...
Lo posto qualora qualcuno possa dirmi dov'è che sbaglio:
codice:
Do While DataReader.Read()
If Trovato = trueThen
testo = "Trovato:"
testolength = testo.Length
Start = (testolength + 1) * count
EsitoRicerca.AppendText(testo & vbCrLf)
EsitoRicerca.Select(Start, testo.Length)
EsitoRicerca.SelectionColor = Color.Blue
testo = "Si"
testolength = testo.Length
Start = (testolength + 1) * count
EsitoRicerca.AppendText(testo & vbCrLf)
EsitoRicerca.Select(Start, testo.Length)
EsitoRicerca.SelectionColor = Color.Green
Else
testo = "Trovato"
testolength = testo.Length
Start = (testolength + 1) * count
EsitoRicerca.AppendText(testo & vbCrLf)
EsitoRicerca.Select(Start, testo.Length)
EsitoRicerca.SelectionColor = Color.Blue
testo = "NO"
testolength = testo.Length
Start = (testolength + 1) * count
EsitoRicerca.AppendText(testo & vbCrLf)
EsitoRicerca.Select(Start, testo.Length)
EsitoRicerca.SelectionColor = Color.Red
End If
count += 1
Loop
Così mi colora tutto il testo con il colore presente nell'ultimo if in cui entra.