Upload
robertbenard
View
1.696
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Object oriented programming - creating custom controls and creating controls at runtime.
Citation preview
OBJECT ORIENTED PROGRAMMINGCONTROLS
Advanced Visual Basic
Overview
Visual Basic has many features that allow you to dynamically create controls and programs. For example, you can create your own objects in Visual Basic that can be used in many applications, just like DLLs. You can also create controls at runtime.
Controls at run-time
There are instances where the number of controls needed at run-time is variable. Consider displaying images on a scrollable form where the user can add as many images as they desire.
Example:
An instance that I use is for scheduling of classes/space. (see next slide)
Controls at run-time (example)
This application reads from a database, creates labels that are sized based on time , and places them on the screen based on start time and location. If there is a double booking in a classroom, the label is made red. This shows the layout of classes for degree flow and space usage.
Controls at run-time
Creating a control at run-time
Dim txtBox as new TextBox()txtBox.Text = “I am a textbox”txtBox.Location = New System.Drawing.Point(10, 55) txtBox.Size = New System.Drawing.Size(130, 95)
Controls at run-time
Question:
Name some other instances where creating controls at run-time would be useful.
Custom/Composite Controls
Composite controls provide a means by which custom graphical interfaces can be created and reused.
A composite control is essentially a component with a visual representation. As such, it might consist of one or more Windows Forms controls, components, or blocks of code that can extend functionality by validating user input, modifying display properties, or performing other tasks required by the author.
Composite controls can be placed on Windows Forms in the same manner as other controls.
Custom/Composite Controls
Custom controls are like DLLs. You create these and then apply them to other applications (as many as you like).
There are companies that focus on creating custom controls and sell them to developers.
Example:
ActiveBarCode.com
Custom/Composite Controls
Question:
What custom controls might you create?
Additional Information
For additional information about these topics, please review your text and the links provided in Blackboard.