Let's say I have an array of, say, 50 picture boxes.
I want the first one to have a backcolor whose Hue is 0, the next to have a Hue of 1, and so forth. But since HSB and RGB are not perfectly interchangeable, how would I code this using a for-next loop?
Well, in order to solve the problem I first decided to make a little converter from RGB to HSB. There are three textboxes and a command button. There are no errors, however the code does not return the correct values for Hue and Saturation based on the RGB values. What am I doing wrong?? (I found a mathematical operation on the web and adapted it... maybe something is wrong).
Note: All variables dimmed as Single
VB Code:
Private Sub Command1_Click()
R = Val(txtR.Text) / 255
G = Val(txtG.Text) / 255
B = Val(txtB.Text) / 255
vMax = Max(R, G, B) 'Function that returns maximum of the three values
vMin = Min(R, G, B) 'Function that returns minimum of the three values