Some arrays problem

Acid Cool

Member
Joined
Dec 2, 2003
Messages
6
Location
Deep in the rabbit hole
I have a paroblem with this function in RGBColor class:

Public Class RGBColor

Public Function getComplement(ByVal rgb As Integer()) As Integer()
some code
End Function

End Class

-----------------------------------------------------------------

ByVal rgb As Integer() --> I guess this is an array...

How do I insert values in it when I call getComplement function.
I must provide this function with 3 integers (r, g, b)? How do I do this?
Please help me....
 
Code:
Dim colors(2) As Integer
colors(0) = 255  Red
colors(1) = 255  Green
colors(2) = 255  Blue

Dim ret() As Integer  Return value
ret = RGBColor.getComplement(colors)

You could also define the getComplement function with three
separate parameters for the red, green, and blue values:
Code:
Public Function getComplement(ByVal red As Integer, ByVal green As Integer, ByVal blue As Integer) As Integer()
some code
End Function

Also, because a color value cant be more than 255, it makes
sense to use a Byte type instead of Integer so that errors will be
raised if the value is out of range.
 

Similar threads

Back
Top