ralph
6/2/2011 9:38:00 AM
On Thu, 02 Jun 2011 09:12:26 +0100, Dee Earley
<dee.earley@icode.co.uk> wrote:
>On 02/06/2011 08:15, ralph wrote:
>> On 02 Jun 2011 06:44:57 GMT, BookWight<Bookwight@publicspam.com>
>> wrote:
>>
>>> Hi -
>>>
>>> I've got a label in a simple counting program and I'm trying to set the
>>> background and foreground colors via a select case statement
>>>
>>> Select Case TumsCounter
>>> Case 0, 1, 2, 3, 4, 5, 6
>>> lblTumsCount.BackColor =&H400000
>>> lblTumsCount.ForeColor =&HFF00<---- prog stops here w/ error
>>> "runtime error 380
>>> invalid property value"
>>
>> I suspect '&HFF' is translated to an Integer (2-byte) with the value
>> of -1, and is used below the surface as a MASK against a 4-byte
>> variable.
>>
>> But frankly I'm not sure what VB might be doing. But correctly typing
>> the number to a Long will fix the problem.
>
>&HFF00 will be expanded (when used as a long) to &HFFFFFF00 which, as it
>says is an "Invalid property value" for a colour.
>
>?hex(&HFF00),&HFF00
>FF00 -256
>?hex(clng(&HFF00)),clng(&HFF00)
>FFFFFF00 -256
>?hex(&HFF00&),&HFF00&
>FF00 65280
Thanks for that correction.
'-256' makes more sense than '-1'. I always manage to confuse myself
when fiddling with a signed bit. You don't go down one, you go down a
lot. <bg>