outline
Download
Skip this Video
Download Presentation
Outline

Loading in 2 Seconds...

play fullscreen
1 / 43

Outline - PowerPoint PPT Presentation


  • 157 Views
  • Uploaded on

Outline. Review Visual Basic .NET Environment First Visual Basic Planning and Programming Finding and Fixing Errors – Debugging Summary. Using Microsoft Visual Studio .NET. Using Microsoft Visual Studio .NET (continue). Naming Rules and Convention. Examples: Object Prefix Example

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Outline' - shona


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
outline
Outline
  • Review Visual Basic .NET Environment
  • First Visual Basic Planning and Programming
  • Finding and Fixing Errors – Debugging
  • Summary
naming rules and convention
Naming Rules and Convention

Examples:

ObjectPrefixExample

Form frm frmHello

Button btn btnPush

Textbox txt txtName

Label lbl lblMessage

Radio button rad radBold

Check Box chk chkPrint

a first program example
A First Program Example
  • Develop a simple program that
    • Display a title
    • Has one Label that display data when a button is pressed
    • Has two Buttons
  • Write procedure code for each event
  • Save the form
  • Save the project
  • Run the program
planning gui design
Planning: GUI Design

Label

ECET/CS 114

frmHello

lblMessage

Text displayed here

Text property

btnPush

Push Me

Exit

btnExit

planning object properties
Planning: Object Properties
  • Form
    • Name: frmHello
    • Text: Hello world
    • Size: as required
  • Label at top of form
    • Let VB name this label (default)
    • Text: “MIS 255” Font: Default, size to fit label box
  • First Information Label
    • Name: lblMessage, Text: Blank, Font: Default, size to fit label box
    • BASIC code in buttons displays data in label
program development example
Program Development Example

Event Statement

Write a VB.NET program that displays the information when a display button is clicked; and exit the program when the exit button is clicked:

  • Press button to display “Hello World”
  • Press button to Exit
define gui
Define GUI

ECET/CS 114

Text displayed here

Push Me

Labels

Exit

define the user interface create a form
Define the User Interface- Create a Form
  • Plan the project – one label, two buttons
  • Resize the form by drag a corner of the form handle it
  • Text –Form1 at the Properties window
define the user interface continued place control on the form
Define the User Interface (continued)- Place Control on the Form
  • Point to the toolbox icon to open the toolbox on the left side
  • Place controls on the form
  • Point to A Label and drag, drop on the form
define the user interface continued create label
Define the User Interface (continued)- Create Label
  • Drag the mouse pointer to the spot where you want to
  • Pointer to a corner and resize the label on the form
define the user interface continued set label properties
Define the User Interface (continued)- Set Label Properties

Object box

Value in the Settings box

Click on the label you place on the form

Settings box

define the user interface continued place control on the form1
Define the User Interface (continued)- Place Control on the Form

Point to

Label in

the Toolbox

and drag,

drop on the

Form to

Create

Another

label

define the user interface continued place control on the form2
Define the User Interface (continued)- Place Control on the Form

Text

property

TextAlign

property

Name

property

define the user interface continued place control on the form3
Define the User Interface (continued)- Place Control on the Form
  • Point to

Button in

the Toolbox

and drag,

drop on the

Form where you want to

  • Point to a corner and resize the button on the form

Assign button name: btnPush

define the user interface continued place control on the form4
Define the User Interface (continued)- Place Control on the Form
  • Double click on the button control to create the second button
  • Point to the control and drag the label on the form

Assign button name: btnExit

define the user interface continued place control on the form5
Define the User Interface(continued)- Place Control on the Form
  • Lock Controls -To prevent your form accidentally moving the controls
define the user interface continued set properties
Define the User Interface(continued)- Set Properties

Object box

Value in the Settings box

Settings box

define the user interface continued set properties for from1
Define the User Interface(continued)- Set Properties for From1
  • Double

click on

Form1

  • Click

Anywhere

on the

Form to

Change

Properties

of the Form

define the user interface continued set properties1
Define the User Interface(continued)- Set Properties
  • Change the Text property to “Hello World by Melissa”
  • Hello World by Melissa is displayed at the title of the Form
  • Change the Name property to frmHello
define the user interface continued set file name
Define the User Interface(continued)- Set File Name
  • In the Solution Explorer, right click on Form.vb
  • Choose Rename from the shortcut menu
define the user interface continued file name
Define the User Interface(continued)- File Name

Change the file name from

Form1.vb to frmHello.vb

define the user interface continued set startup object
Define the User Interface(continued)- Set Startup Object

In the Solution Explorer, click on project1, then properties

Name

of the

Form

class

filename

define the user interface continued set startup object1
Define the User Interface(continued)- Set Startup Object
  • In the Project Property dialog box, drop down the list for Startup Object and select frmHello
  • Click Apply then click OK
comments and the assignment statement
Comments and the Assignment Statement
  • Comment
    • used to document code
    • Syntax example

' this is a comment

  • Assignment
    • used to assign a value to a property (or a variable)
    • Syntax

variable = value

    • Examples

Pi = 3.14

lblMessage.ForeColor = Color.Red

lblMessage.BackColor = Color.Yellow

lblMessage.Text = "WebCT is a pretty good tool."

write code
Write Code
  • Develop a Visual Basic code in Procedures
  • A sub procedure begins with Private Sub and ends with End Sub
  • The Remark statement
    • Comments
  • The Assignment Statement
    • Assigns a value to a property or variable
    • Ex: btnHello.Hide()

lblMessage.Show()

Me.Close()

write code continue
Write Code (continue)
  • A Space then an Underline enables you to press the enter key and continue a line of code on a new line.
  • Each method is defined as a VB procedure
  • For methods which correspond to events, VB automatically names the procedure
  • Private Sub btnPush_Click(ByVal sender As System.Object, _
  • ByVal e As System.EventArgs) Handles btnPush.Click
  • End Sub
write code continued
Write Code(continued)

Click on Push Me button

write code continued1
Write Code(continued)

Form Designer tab

Editor tab

Class List

Method List

Remark Statement

Assignment Statement

write code continued2
Write Code(continued)

Click on Exit button

write code continued3
Write Code(continued)

Edit one

line of

Comment

and one

line of

Code

Class List

Method List

save the project
Save the Project
  • Open the File menu
  • Choose Save All
compiler the project
Compiler the project

Click on Build, then

Select Build Solution

run the project
Run the Project
  • Open the Debug menu
  • Select Start without debugging
result of the project
Result of the Project
  • When Click on Push Me button – display Hello World
  • When Click on Exit button – Close the window
slide42
The VB Environment

Code View

Help

summary
Summary
  • Program Planning and GUI
  • Visual Basic Programming
    • Use Toolbox
    • Edit properties
    • Write code
    • Run the project
ad