DotNetWebTutor.com                                                    Link to Us

Controls Overview

contorls overview
Controls are preprogrammed pieces of interface code
Controls are components that combine a graphical interface with functionality. They are reusable pieces of code designed to do a task.

All controls inherit from the base class called Control

You can resize a control by selecting is and dragging and edge or corner

Controls can be moved by selecting them and dragging them around in the form

Select multiple controls by holding the ctrl key down
programming windows process
Process of programming Windows

  1. Position a control- by dragging the from the toolbox to the form
  2. Change properties of a control
  3. Write code for a control

create visual basic project
Create Project
Visual Studio creates the following folders when it creates a project:

  • Reference Folder – holds parts of the Framework that you will use in this project
  • Bin Folder – holds the finished program and any components
  • Obj Folder – hold any resource specific to the application
  • MyProject Folder –holds configuration files

vb form
Form
Rename the default form by right-clicking and select rename
Resize the form by clicking on the handle in the lower right corner and dragging it to a new position
drag controls to the form
Drag controls to the form
Controls are named by default using the control name and an incremental number

After you drag a control to the form it becomes an instance of the control
control Events
Control Events
Select a control
Loop at properties
Click lightning bolt button
You see possible events of that control

  1. Double click the event to generate a method to handle that event
  2. Or type a method name to handle that event
  1. Or click drop down arrow next to the event and choose event code for this event

event handlers
Event handlers
Code to respond to event
Methods with a special signature
You can have one event handler respond to the same event on many different controls

visual basic controls