Control Arrays : Control Arrays By Sohit Sharma
+919810374740
Introduction : Introduction A control array can be defined as the group of controls that share the same name and type.. They also share the same event procedure. 2 Presented By Sohit Sharma
Why Control Arrays? : Why Control Arrays? It uses fewer resources.
It is useful when you want several control for same code, for example if three option buttons are created, then we need only one code to access the value.
Control arrays are used in an object with same functionality, Example Calculator. 3 Presented By Sohit Sharma
Control arrays can be created at: : Control arrays can be created at: 4 Presented By Sohit Sharma Run time Design time
Design time : Design time Draw the controls you want in control array.
Select one of the controls and change its Name. Example “Array”.
When you add another control with same name then VB will ask for confirmation about making it a control array. 5 Presented By Sohit Sharma
Example : 6 Change name of all textbox to text. Example Presented By Sohit Sharma
Coding : Coding 7 Presented By Sohit Sharma
Run time : Run time Control array at run time can be added using Load command.
After adding Load the visible property should be changed to True.
We can also use Unload command to remove any control during run time. 8 Presented By Sohit Sharma
Example : Example 9 Presented By Sohit Sharma
Coding : Coding 10 Presented By Sohit Sharma
Output : Output 11 Presented By Sohit Sharma
Using Unload command : Using Unload command 12 Presented By Sohit Sharma
Output : Output 13 Presented By Sohit Sharma
Slide 14 : 14