Control Arrays, Scroll Bars and RGB Function
Array - A group of data items that are referred to by the same name.
Control Array - A group of controls sharing the same name and event procedures.
Index - A variable used to refer to each element in the control array.
Control Arrays can be used with the following controls:
Control Arrays are most commonly used with text boxes and option buttons.
CREATING A CONTROL ARRAY:
Example Control Array using a Select Case:
This example is if you had six option buttons with names of colors and a Rounded Square shape that will fill the color of the selected option button.
SUM AND AVERAGE OF TEST SCORES USING CONTROL ARRAYS:
Here is another example of a control array. This will be if you wanted to figure the sum and average of test scores.
Scroll Bars and RGB Function
Scroll Bar - A control that allows you to see hidden information on the screen. This information can be text, icons or controls.
In VB a scroll bar is used to represent a range of values. Scroll bars are also used to control sound level, color, size and other values that can be changed in small amounts or large increments.
Scroll Box - The little square, which appears inside the scroll bar. Pressing down on the scroll box changes the value property of the scroll bar. Another name for the scroll box is the thumb.
PROPERTIES OF THE SCROLL BAR:
TYPES OF SCROLL BARS:
EVENTS OF THE SCROLL BAR:
Change Event - Occurs when the user clicks on the gray area of the scroll bar.
Scroll Event - Occurs when the user drags the scroll box.
As soon as the user releases the mouse botton, the scroll event ceases and a change event occurs. When you write code for the scroll bar, you will want to write code for both Change even and the Scroll event.
SAMPLE PROGRAM USING HORIZONTAL SCROLL BAR:
SAMPLE PROGRAM USING VERTICAL SCROLL BAR:
The RGB function specifies the quantities of red, green and blue for a large variety of colors. The value for each color ranges from 0 to 255 with 0 being the least intense and 255 being the most intense. The color arguments are in the same order as their letters in the function name, red first, then green and then finally blue. You can use the RGB function to assign the color to a property or specify the color in a graphics method.
Chosen_Color = RGB(RedValue, GreenValue,BlueValue)
No Comments for this page.