EGR 141 Computer Problem Solving in Engineering and Computer Science - PowerPoint PPT Presentation

About This Presentation
Title:

EGR 141 Computer Problem Solving in Engineering and Computer Science

Description:

Program: Lab 1 - Hello World. Form: frmHello. Programmer: Robin Bank ... System.Drawing.Color.Yellow. System.Drawing.Color.Blue. System.Drawing.Color.Magenta ... – PowerPoint PPT presentation

Number of Views:138
Avg rating:3.0/5.0
Slides: 13
Provided by: lisal173
Category:

less

Transcript and Presenter's Notes

Title: EGR 141 Computer Problem Solving in Engineering and Computer Science


1
EGR 141Computer Problem Solving in Engineering
and Computer Science
  • Data Types and Variables

2
Strings
(248) 555-1212 Hello, this is a string! The
article Small Miracles is good This is an
example of a string in Visual Basic _ that
goes for more than one line. It can even
_ go on for three lines.
Quotes within a string
String Continuation
Empty String
3
Strings
lblThetext.Text This is the caption for the
control _ called lblThetext!
String continuation
4
Strings
Putting the strings together lblText.Text
Hello txtName.Text ! lblText.Text
Hello txtName.Text ! lblText2.Text Welcome
txtName.Text _ to the Grand
Hotel.
Concatenation
5
Comments
Begin a comment with a mark This is a
comment lblText.Text Hello Put Hello
in the box Program Header Program
Lab 1 - Hello World Form
frmHello Programmer Robin Bank Purpose
The user can enter their name and when
they click the Show Message button
it will welcome them.
6
Variable Names
  • VB Rules
  • lt 255 characters
  • must begin with an alphabetic character
  • can't contain punctuation characters (except
    underscore "_")
  • must be unique within the same scope
  • case insensitive
  • can't be the same as a keyword
  • Textbook Conventions
  • be meaningful and descriptive
  • use consistent abbreviations for same word
  • use entire words or initial syllables
  • use mixed case, with a capital letter at the
    start of each word ("camel-back notation")
  • Generally between 5 and 20 characters.

7
Data Types
  • Data Types
  • Short. A non-decimal (whole) number with a value
    in the range of -32,768 to 32,767.
  • Integer. A non-decimal (whole) number with a
    value in the range of -2,147,483,648 to
    2,147,483,647.
  • Long. A non-decimal (whole) number with a value
    in the range of -9,223,372,036,854,775,808 to
    9,223,372,036,854,775,807.

8
Data Types
  • Data Types
  • Single. A floating-point (decimal) positive or
    negative number with a value in the range of up
    to 3.402823E38 (scientific notation).
  • Double. A floating-point (decimal) positive or
    negative number with a value in the range of up
    to 1.79769313486232E308.
  • Decimal. A decimal number with a value in the
    range of up to 79,228,162,514,264,337,593,950,335
    . without decimal precision and up to
    7.9228162514264337593543950335 with 28 places of
    decimal precision.
  • String. Any number of alphabetic, numerical, and
    special characters.
  • Date. Dates in the range between January 1, 0001
    to December 31, 9999 and times in the range
    between 00000 to 235959.
  • Boolean. The value True or False.

9
Data Types
  • Data Types
  • String. Any number of alphabetic, numerical, and
    special characters.
  • Date. Dates in the range between January 1, 0001
    to December 31, 9999 and times in the range
    between 00000 to 235959.
  • Boolean. The value True or False.

10
Declarations
Dim MyNumber As Long Dim MyDecimal As Double Dim
NumberA, NumberB, NumberC As Long Dim message As
String Dim fName, lName As String Const PI As
Double 3.14159
11
Declarations
Built-in Constants System.Drawing.Color.Black Sy
stem.Drawing.Color.Red System.Drawing.Color.Lime S
ystem.Drawing.Color.Yellow System.Drawing.Color.Bl
ue System.Drawing.Color.Magenta System.Drawing.Col
or.Cyan System.Drawing.Color.White
12
Usage
Form1.ActiveForm.BackColor System.Drawing.Color.
Red _____________________________________________
____ Me.BackColor System.Drawing.Color.Red
________________________________________________
_
Refers to the current, active form
Write a Comment
User Comments (0)
About PowerShow.com