Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color code changes 1

Status
Not open for further replies.

domt

Programmer
Mar 13, 2001
115
US
Can someone please straighten me out on using color codes in VB6.
My code codes some Command buttons to be white (&H0000005&),
and yellow (&HFFFF).The command buttons are in graphic style.
I then save the program to a text file.
The text file records the codes as -2147483643 and 6555. ???
What happens and how can avoid this?
Any help would be greatly apreciated.
 
immediate window (debug window):
? vbWhite

[tab]and

? vbYellow

MichaelRed


 
Firstly &H0000005& isn't white; it is black (almost). So I suspect that you actually meant &H80000005&, which is the Hexadecimal representation of a System Color, specifically Window Background (which, unless you happen to have changed it in Control Panel, is generally white).

The decimal value of &H80000005& (since the conversion treats it as a signed long) is -2147483643

And &HFFFF is indeed the hexadecimal representation of the RGB value for yellow. And the decimal value of that (again, treating it as a signed long) is 65535

So the values in your text file are correct

Mind you, I'd be interested to know which version of VB you are using that retains a specific "save as text option" (you don't get a choice in VB6, and VB6 retains the hexadecimal values in the text files, so I'm assuming you are using a different version)
 
Thanks for your replies.
My coding does not actually write the coding for white, it picks that from examining the ".Backcolor" property from another object,so I made a typo error in re &H80000005&.

I'm using VB6 with SP2. "Help" informs me that the version is 8176.
 
Well, then I still don't quite understand how you "save the program to a text file". Might I suggest thay you patch up to SP6B
 
strongm
What I should have said was that the RESULTS obtained by the program contain the color codes and are saved to a text file. When, later, the program accesses the text file it ueses the codes stored.
Thank you for your interest and your suggestion.
Can you tell me how I can update to SP6B?
 
>the RESULTS obtained by the program contain the color codes and are saved to a text file

Ah, right. well that shouldn't be a problem. The numbers in your text file are the correct decimal representations of the colours you selected. They can be read in from the text file and assigned to the BackColor property to give the correct colors.

However, if you want to see the Hex values in the text file, then instead of outputting [tt]Command1.BackColor[/tt] to your textfile output [tt]Hex$(Command1.BackColor)[/tt] instead

>Can you tell me how I can update to SP6B?

Sure. If you click on the underlined SP6B in my post above you should be taken to the Service Pack 6B download page. It has the necessary file and some instructions.

 
Thank you very much for all your help.
I downloaded the SP6B file.
In running it it asked me where I wanted it installed.
Any suggestions?
 
Follow the instructionsd on the linked page. Youb are not being asked where to install the patch. It is a compressed file, and ios asking where you want the contents to be extracted to.

The relevant portion of the instructions are:

Before starting the download, create a download directory on your computer. If your internet connection is less than 300K, it is recommended that you run the multi-part download by following the "More Information" link at the upper right, then clicking "Download Now."

Click "Download" to begin downloading the single download. When prompted by the download software, choose the option "Save this program to disk" and click OK. Then select the directory you created on your computer.

Run the file from the download directory. When prompted, select the same directory you created on your computer. You will be expanding the contents of the EXE into this directory.

Run SetupSP6.exe from the download directory. When you accept the terms of the electronic End User License Agreement (EULA) the setup software will replace the appropriate files in your Visual Basic 6.0 installation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top