Solved

Writing out to a log with colour font in VB6

Posted on 2003-12-09
8
1,233 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:ISC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Author Comment

by:ISC
ID: 9905067

Should also add...

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


Thanks Ian
0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 9905068
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
 
LVL 1

Author Comment

by:ISC
ID: 9905098
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 9905374
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
 
LVL 29

Expert Comment

by:leonstryker
ID: 9906553
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
 
LVL 1

Expert Comment

by:Moglor
ID: 9907110
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
 
LVL 9

Expert Comment

by:malharone
ID: 9908510
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
 
LVL 18

Expert Comment

by:bobbit31
ID: 9909249
or export to html
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question