Ayuda con cambio de color de texto en richtextbox
Publicado por Oscar (1 intervención) el 20/08/2005 19:21:28
Hola a todos:
Quisiera saber si me pueden ayudar con un problemilla que tengo con un ritchtextbox, lo que busco es saber como puedo cambiar el color de la letra en un richtextbox, teniendo en cuenta que los numeros son de un color y las letras de otro, ayuda urgente, lo que llevo es lo siguiente:
Dim archivo As New OpenFileDialog
Dim i As Integer
archivo.FileName = "D:\*.txt"
archivo.ShowDialog()
r1.LoadFile(archivo.FileName, RichTextBoxStreamType.PlainText)
Dim vector() As String
Dim separador(3) As Char
separador.SetValue(Chr(32), 0)
separador.SetValue(Chr(10), 1)
separador.SetValue(Chr(12), 2)
vector = r1.Text.Split(separador)
For i = 0 To vector.Length - 1
If IsNumeric(vector.GetValue(i)) Then
L1.Items.Add(vector.GetValue(i))
Else
L2.Items.Add(vector.GetValue(i))
End If
Next i
Dim lugar As String
For i = 0 To R1.Text.Length - 1
MsgBox(vector.GetValue(i))
If Not IsNumeric(vector.GetValue(i)) Then
lugar = R1.Find(vector.GetValue(i))
'R1.Select(lugar, L1.Items.Item(i))
R1.SelectionColor = System.Drawing.Color.Red
Else
lugar = R1.Find(vector.GetValue(i))
'R1.Select(lugar, L1.Items.Item(i))
R1.SelectionColor = System.Drawing.Color.Purple
If EOF(R1.Text) Then
Exit For
End If
End If
Next i
ese es todo el programa, le agradesco de ante mano
Quisiera saber si me pueden ayudar con un problemilla que tengo con un ritchtextbox, lo que busco es saber como puedo cambiar el color de la letra en un richtextbox, teniendo en cuenta que los numeros son de un color y las letras de otro, ayuda urgente, lo que llevo es lo siguiente:
Dim archivo As New OpenFileDialog
Dim i As Integer
archivo.FileName = "D:\*.txt"
archivo.ShowDialog()
r1.LoadFile(archivo.FileName, RichTextBoxStreamType.PlainText)
Dim vector() As String
Dim separador(3) As Char
separador.SetValue(Chr(32), 0)
separador.SetValue(Chr(10), 1)
separador.SetValue(Chr(12), 2)
vector = r1.Text.Split(separador)
For i = 0 To vector.Length - 1
If IsNumeric(vector.GetValue(i)) Then
L1.Items.Add(vector.GetValue(i))
Else
L2.Items.Add(vector.GetValue(i))
End If
Next i
Dim lugar As String
For i = 0 To R1.Text.Length - 1
MsgBox(vector.GetValue(i))
If Not IsNumeric(vector.GetValue(i)) Then
lugar = R1.Find(vector.GetValue(i))
'R1.Select(lugar, L1.Items.Item(i))
R1.SelectionColor = System.Drawing.Color.Red
Else
lugar = R1.Find(vector.GetValue(i))
'R1.Select(lugar, L1.Items.Item(i))
R1.SelectionColor = System.Drawing.Color.Purple
If EOF(R1.Text) Then
Exit For
End If
End If
Next i
ese es todo el programa, le agradesco de ante mano
Valora esta pregunta


0