Acid Cool Posted December 26, 2003 Posted December 26, 2003 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.... Quote
*Experts* Bucky Posted December 26, 2003 *Experts* Posted December 26, 2003 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: 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 can't 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. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Acid Cool Posted December 26, 2003 Author Posted December 26, 2003 OK, I solwed this problem all ready, but thanks the getComplement function must be defined as I wrot, because the exercise told this.... THNX again Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.