Writing out to a log with colour font in VB6

Hi,

Is it possible to write out to a log file setting the font to a colour i.e., red...?

I am trying to high-light in red only those lines that contain error messages.

I am using VB6 on Windows 2000.

Thanks Ian Carrick
LVL 1
ISCAsked:
Who is Participating?
 
bobbit31Commented:
sure, use the microsoft rich textbox control (under project/components)

using the properties w/in that control you can specify font color and other characteristics.

then do RichTexbox1.saveFile "test.rtf"

this should save it as a rich text formatted text file and should retain the color info. (this can be opened in wordpad/word/etc...)
0
 
ISCAuthor Commented:

Should also add...

I am using a 'Textstream' object to write out to my log file...


Thanks Ian
0
 
ISCAuthor Commented:
Hi,

My VB program does not have a UI.

My program just opens a text file does some processing...during processing events are logged....I only want to high-light certain lines....

Thanks Ian
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You can't have text formatting in a plain text file.

You don't need to have the interface visible to the end user to accomplish this.  

bobbit31 has a great idea.  Open the text file and place its contents into a richtextbox control.  Then you can apply formatting to the text as you desire and save it back out as an RTF file.

Idle_Mind

0
 
leonstrykerCommented:
Test files do not support color fonts.  If you want colored text in your log file you should send it to a Word document, or Excel, or any other application which does.

Leon
0
 
MoglorCommented:
if all you want to do is make errors more visible within a text file then i would put some distinguishing marks before and after the error message like this...

***Error Message Here***
or
###Error Message Here###

with plain text, in something like Notepad, there isnt any way to change the color or font of the text.
0
 
malharoneCommented:
why not export to an XML file ... which can be displayed using an XSD file..
for example, use Microsoft's Messenger, and log conversations. they save to an XML file ... which is displayed in full colors using the XSD files.

hope this helps
0
 
bobbit31Commented:
or export to html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.