9
hat is Visual Basic.NET 110 B-1 a word processor doesn’t do anything l the user clicks on a button, types te A programming language that _ uses event driven programming _ uses objects Event driven he programmer writes code(=program) o describe what happens when the user oes something (mouse click...).

What is Visual Basic .NET?

Embed Size (px)

DESCRIPTION

What is Visual Basic .NET?. _ uses event driven programming. _ uses objects. Event driven. A programming language that. The programmer writes code(=program) to describe what happens when the user does something (mouse click...). e.g. a word processor doesn’t do anything - PowerPoint PPT Presentation

Citation preview

Page 1: What is Visual Basic .NET?

What is Visual Basic.NET?

110 B-1

e.g. a word processor doesn’t do anything until the user clicks on a button, types text...

A programming language that

_ uses event driven programming

_ uses objects

Event driven

The programmer writes code(=program)to describe what happens when the user does something (mouse click...).

Page 2: What is Visual Basic .NET?

110 B-2

Things that you can use in your program. An example would be an OK button

An object has events: The user can interact with the object, e.g she can click on the button

An object has methods: an action associatedwith the object, e.g.Move, Resize...

An object has properties: size, color…

Object

Page 3: What is Visual Basic .NET?

110 B-3

Planning:

GUI (Graphical User Interface)

Programming:

Designing an application

_ know the users' needs

_ sketch what you want the user to see on the screen

_ write an algorithm to solve the problem

Build the GUI using VB.NET: choose the objects, set their properties(lots of mouse clicks!)

Write a program using VB.NET: Following your algorithm write a VB program (what happens when the user types, clicks…). Do this by writing code for events associatedwith your objects.

Page 4: What is Visual Basic .NET?

110 B-4

When building an application, work within a Solution (project)

A project contains one or more forms: where the GUI will be displayed.

To design a form, use

To write the program, use the code window

The different elements of a project aredisplayed in the solution explorer.

VISUAL STUDIO.NETIntegrated Development Environment

_ toolbox: contains objects that you can put on the form_ properties window: to set the properties of the objects

_ form designer: to design the GUI

Page 5: What is Visual Basic .NET?

110 B-5

Goal: when the user clicks on a button labeled “Display”, a welcoming message appears on the form.

Objects needed: A form A button A label to display the message

Sketch:

Display

before clicking

Display

after clicking

Welcome to VB

label: lblMessage

button:btnDisplay

form: frmWelcome

A simple application

Page 6: What is Visual Basic .NET?

110 B-6

form

Text

frmWelcome identifies the form

button

Name identifies display button

Property Description

Object PropertyProperty setting

form title bar display

Welcome

Text

Font

btnDisplay

Display

MS sans Serif8 pt bold

Text on button

Font for text on button

Setting up the form

Name

Page 7: What is Visual Basic .NET?

110 B-7

label

False message is hidden at the start

Property Description

Object PropertyProperty setting

Name

Text

Font

Visible

lblMessage identifies the label

Welcome to VB

text of the label

MS sans Serif18 pt bold

font for textof the label

Page 8: What is Visual Basic .NET?

110 B-8

Has the userclicked on theDisplay button?

Yes

Make the labelVisible

Object dot: operator to access the property of an object

Property

assignmentoperator

property setting

lblMessage.Visible = True

No

HOW?

Write in the program

The algorithm

Page 9: What is Visual Basic .NET?

110 B-9

form: What the user sees. Put objects of the toolbox on the form

code: The program that is written to manage events What to do when the user interacts with the controls (buttons…) on the form

naming conventions: _use prefixes for names of objects btn for a button lbl for a label frm for a form

_ have meaningful names e.g. btnExit for a button to exit

Summary