Solved

Writing out to a log with colour font in VB6

Posted on 2003-12-09
8
1,231 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
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 85

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy a row 12 69
Prevent user closing word document opened with VB6 6 84
VBA: Insert New column with specific format type 12 52
Dinamic report to Crosstab query 9 49
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

740 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