Introducing User Controls and Managing Components: Objectives
Introducing User Controls and Managing Components: Objectives
Components
Objectives
In this lesson, you will learn to:
☛Create customized user controls
☛Add existing components and controls to a user control
☛Declare and raise events in a user control
☛Call methods of other objects by using delegates
User Controls
☛Are custom controls that can be created by using a number
of existing controls.
☛Can contain several child controls.
UserControl Class
☛Helps in creating composite reusable controls with
selectively exposed properties.
☛Can be used to combine the functionality of different
controls into one unit that can be reused.
☛Presents a single and unified interface that contains
members inherited from the control classes.
Just a Minute…
2. Which method will you override to render graphical users
to customized controls?
3. What format string will you use to specify a date in the
year-month-date format?
4. How will you ensure that an entire control is redrawn?
Task List
☛Identify the component to be added to the user control.
☛Identify the controls to be added to the user control.
☛Add controls and components to the user control.
☛Write code for the user control.
☛Verify the execution of the user control.
Event Handlers
☛ Special type of Sub procedures that are called when an
event occurs.
☛ Are declared using the Handles keyword.
☛ Can handle multiple events.
Example
Private Sub Button1_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles Button1.Click, MenuItem1.Click
' some code
End Sub
Just a Minute…
2. Identify the syntactical error in the following code snippet.
3. Fill in the blank:
In Visual Basic .NET, delegates are ___________ types
base on the System.Delegates class.