VB'Net Language Basics - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

VB'Net Language Basics

Description:

Comments are text we want compiler to ignore are NOT executable statements. VB comments indicated with single-quote (apostrophe) and are green in IDE ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 13
Provided by: cisUso
Category:

less

Transcript and Presenter's Notes

Title: VB'Net Language Basics


1
VB.Net Language Basics
  • R. Johnson ITE 285

2
Comments
  • Comments are text we want compiler to ignore
    are NOT executable statements
  • VB comments indicated with single-quote
    (apostrophe) and are green in IDE
  • I expect comments for identifying yourself,
    assignment, purpose, and elsewhere for clarity
  • There is no block comment like //
  • Older code may use REM (remark)

3
Variable Declarations
  • Associate a variable name to be used with a data
    type
  • Form Dim name As type
  • May have Const, Private or Public instead of Dim
  • Initialize Dim strName As String Joe
  • Effectively not case-sensitive IDE keeps case
    consistent w/ declaration

4
VB.Net Data Types
5
Literal Values
  • 4 Integer
  • 4.24 Double
  • John String
  • y Char from context
  • 3/1/2006 Date

6
Operators
  • Assignment
  • Arithmetic
  • Relational (comparison)
  • Logical
  • Dot operator

7
Assignment
  • The serves exact function as in Java
  • In an expression such as yy1
  • Right hand side is evaluated
  • Result is copied to left hand side variable

8
Arithmetic Operators
  • Addition
  • - Subtraction
  • Multiplication
  • / Division
  • \ Integer Division
  • Mod Modulus or remainder (like Java )
  • Operator precedence is similar to Java, ( ) to
    override it.

9
Relational Logical Operators
  • Equality test with (not )
  • Not Equal ltgt instead of !
  • gt, lt, gt, lt just like Java
  • AND instead of
  • OR instead of
  • NOT instead of !

10
Calling Procedures
  • A procedure is like a Java method
  • Sub (short for subroutine) is like a Java void
    method.
  • A Sub call is always a standalone statement.
  • Function is like a Java method that returns a
    result that replaces the call in the larger
    expression.

11
Event Handling Procedures
  • For now we write most of our code in Event
    Handling Procedure Subs.
  • Similar to Java ActionListener
  • We never call these directly
  • Instead .NET passes event from interface, calling
    our Event Handler Sub when needed.
  • Handles event list can respond to more than one
    event.

12
Built-In Functions
  • Many functions follow OOP paradigm
  • string methods, e.g. Name.IndexOf(i)
  • Math functions e.g. Math.Sin(x)
  • Intrinsic functions are standalone
  • Val(mystring), CDbl(mystring), CInt(mystring)
  • IsNumeric( mystring)
  • FormatNumber(x, 2)
  • Financial functions, random numbers
Write a Comment
User Comments (0)
About PowerShow.com