+ All Categories
Home > Documents > Controls

Controls

Date post: 09-Dec-2014
Category:
Upload: nickywalters
View: 2,532 times
Download: 0 times
Share this document with a friend
Description:
 
Popular Tags:
19
1 Windows GUI Controls and Events VB.NET
Transcript
Page 1: Controls

1

Windows GUIControls and Events

VB.NET

Page 2: Controls

22

Windows GUI

Visual Basic is the most widely used tool for developing Windows applications.

Windows applications utilise a GUI that provides visual cues to the user that allow the user to work intuitively and efficiently.

Windows applications contain WYSIWYG“What You See Is What You Get”

Page 3: Controls

33

Working with Objects

An object is anything we might use in our application for acquiring, manipulating, or presenting data or information.

An object contains properties (data) and methods (actions for manipulating an object’s data).

An object is defined once as a class.

Page 4: Controls

44

Working with Objects (cont.)

The developer creates as many instances of the object as necessary for the application.

The .NET class library is a large library of classes with reusable code included in the Microsoft .NET Framework.

.NET uses namespaces, which are collections of related classes/ System.Windows.Form is the namespace containing

classes for creating Window based applications.

Page 5: Controls

55

Reuse and Reliability

One of the most powerful features of object classes is that they are reusable.

The Control class contains numerous properties and methods common to all controls for developing the user interface.

Objects can enhance reliability, which is the result of good design and lots of testing. Do not reinvent the wheel

Page 6: Controls

66

Control Objects

The Button control is considered to be the most basic graphical control.The Label control is used to display text that cannot be edited by the user.The PictureBox control is used to display graphics.The Timer control is used to raise an event at user-defined intervals.

Page 7: Controls

77

Controls

Timers

Labels

Pictureboxes

Menus

Page 8: Controls

88

Controls

Understand and effectively use the TextBox, ListBox, and ComboBox controls

A TextBox control provides GUI form input by providing an area on the form where the user can enter data while the program is executing.

A ListBox control provides GUI form input as a list of items that the user can select by clicking.

A ComboBox control combines the functionality of the TextBox and ListBox controls.

Page 9: Controls

99

TextBox Control

The TextBox control provides an area for the user to enter data while the program is executing.

TextBox controls can also be used to display output on the form.

Page 10: Controls

1010

TextBox PropertiesProperty Description

Name (“txt” prefix) used to access the control in code

Font Gets or sets the font of the text displayed in the control

Maxlength Sets the maximum number of characters allowed

Multiline Allows more than a single line of text to be entered

Passwordchar Sets the character used to mask typed text (Single line only)

ReadOnly Stops text from being edited by the user

ScrollBars Sets which ScrollBars appear (Multiline only)

Text Gets or sets the text displayed in the control

WordWrap Indicates if text is automatically wrapped to next line

Page 11: Controls

1111

TextBox Methods

Page 12: Controls

1212

ListBox Control

The ListBox control makes a visible list of items.

The user can select items in the list using mouse clicks.

Page 13: Controls

1313

ListBox Properties

Page 14: Controls

1414

ListBox Methods

Page 15: Controls

1515

ComboBox Control

The ComboBox control combines the functionality of the TextBox and ListBox controls.

The user can select values from the drop-down list or enter values directly into the text box area.

Page 16: Controls

1616

ComboBox Properties

Page 17: Controls

1717

Working with Events

Visual Basic supports event-driven programming in which the application recognizes and responds to events.An event is an action or occurrence recognized by some object and for which you can write code to respond.And event handler contains code that responds to a particular event.

Page 18: Controls

1818

Event ProceduresThe naming convention for an event procedure is the keyword Sub followed by the name of the triggering object followed by an underscore character followed by the name of the event e.g. Timer event

Page 19: Controls

1919

Summary

Visual Basic is an object-oriented, event-driven language.

An object is a self-contained entity that has both properties and methods.

Most of the objects you will need are available in VB. NET (forms & controls are objects)

An event refers to an action or change detected by a program.

An event procedure is the method that handles or responds to an event.


Recommended