|
-
Aug 24th, 2004, 10:13 PM
#1
Thread Starter
Frenzied Member
String to RichText? (Solved)
I have a string that has the following symbols:
(This is an old project I am trying to code better)
I put this text in a richtextbox and loop through it changing the *-O into an M using the font "Wingdings" with size 10 and color vbBlue...
This *-O appears a lot in the string and so it makes the form load after a lot of time... I was wondering if there was an easier (and faster) way to do this in order to display the text correctly in the RichTextBox.
I appreciate your help
P.S. I want to change the -> to g using the font "Wingdings 3", size 10 and color vbBlack and then-v to ? using the font "Wingdings 3", size 10 and color vbBlack (just in case you were wondering about it)
Last edited by Tec-Nico; Oct 3rd, 2004 at 01:49 PM.
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
-
Aug 24th, 2004, 11:46 PM
#2
Thread Starter
Frenzied Member
Nevermind, I found a way:
VB Code:
Public Function changeDefaultFormat(strReplaced As String) As String
changeDefaultFormat = "{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}{\f1\fnil\fcharset2 Wingdings;}{\f2\fnil\fcharset2 Wingdings 3;}}" & vbNewLine
changeDefaultFormat = changeDefaultFormat & "{\colortbl ;\red0\green0\blue255;\red0\green0\blue0;}" & vbNewLine
changeDefaultFormat = changeDefaultFormat & "\viewkind4\uc1\pard\lang2058\f0\fs17" & vbNewLine
strReplaced = Replace(strReplaced, vbNewLine, "\par " & vbNewLine)
strReplaced = Replace(strReplaced, "*-O", "\cf1\f1\fs20 M\cf0\f0\fs17")
strReplaced = Replace(strReplaced, "->", "\cf2\f2\fs20 g\cf0\f0\fs17")
strReplaced = Replace(strReplaced, "-v", "\cf2\f2\fs20 ?\cf0\f0\fs17")
changeDefaultFormat = changeDefaultFormat & strReplaced
End Function
Thanks anyway!
Last edited by Tec-Nico; Aug 24th, 2004 at 11:50 PM.
We miss you, friend...  Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|