Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Writing out to a log with colour font in VB6

Posted on 2003-12-09
8
Medium Priority
?
1,235 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 600 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
Technology Partners: 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Suggested Courses

688 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