#Passing Values to Arrays
7 messages in this thread
I have what is probrably a very basic(simple) question but since I can't
seem to find it in the Doc's I'll show my ignorance.
I have 3 horz. scroll bars on a form. Control Names HScroll1,HScroll2 &
HScroll3.
I would like to pass the values of these Scroll1 Bars ( in Hex Form ) to an
Array. Ultimately these values are part of the SetSysColor call I make to
Windows.
I thought it might be something like:
ReDim MyRGB&(3)
MyRGB&(1)=Hex$(HScroll1.value)
etc.
But I get an Expression Expected error. Any Suggestions ??
……..Chet
There are 2 Replies.
Hi Chet,
Hex$ is a string function like Str$. So you are trying to assign a string
to a numeric array element MyRGB&. But more important, numbers aren't
stored in Hex form, or Octal form or even Decimal form in a digital
computer. They are stored in binary form. Fortunately, for the most part we
don't have to worry about the exact format. Just use MyRGB&(1) =
HScroll1.Value. That will meet the requirements of SetSysColor since it
expects an array of unsigned long integers.
KeithF
There is 1 Reply.
Thanks Keith. That makes my life much easier.
………Chet
Chester,
You are trying to assign a string (HEX$) to a LONG (MyRGB&). You
should be able to simply MyRGB&(1) = HScroll1.Value. Are these scroll
bars, RED, GREEN and BLUE? If so, you are going to need to create a
composit number first before you assign it to MyRGB&. In this case, your
line might look like: MyRGB&(1) = RGB(HScroll.Value, HScroll2.Value,
HScroll3.Value). Clear? -=- Jonathan
There is 1 Reply.
My HScroll values vary from 0 to 255, so your advice MyRGB&(1) =
HScroll1.value is right on the money. Thanks.
………Chet
There is 1 Reply.
Chet,
Just to clarify something here:
MyRGB&(1) = &HC00FFFF ' This is a long integer
' only the notation is hexadecimal
Costas
There is 1 Reply.
Oh, I see.
Thanks Costas
………….Chet