CompuServe Thread

#Passing Values to Arrays

7 messages in this thread
#3082From: Chester L. KlossOct 14, 1991 9:06 PM
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.
#3110From: Keith Funk/Vanc.BC,CAN.Oct 14, 1991 11:50 PM
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.
#3139From: Chester L. KlossOct 15, 1991 7:21 AM
Thanks Keith. That makes my life much easier. ………Chet
#3116From: Jonathan Zuck (UFI)Oct 15, 1991 12:01 AM
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.
#3141From: Chester L. KlossOct 15, 1991 7:24 AM
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.
#3272From: Costas KitsosOct 15, 1991 6:48 PM
Chet, Just to clarify something here: MyRGB&(1) = &HC00FFFF ' This is a long integer ' only the notation is hexadecimal Costas There is 1 Reply.
#3315From: Chester L. KlossOct 15, 1991 10:05 PM
Oh, I see. Thanks Costas ………….Chet