Visual basic net fundamentals
Download
1 / 12

Visual Basic .NET Fundamentals - PowerPoint PPT Presentation


  • 72 Views
  • Uploaded on

Visual Basic .NET Fundamentals. Objectives. Use primitive data types, naming conventions, and style rules Understand and apply the control structures supported in Visual Basic .NET Explain the objects and techniques involved in the creation of a Multiple Document Interface (MDI) application

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 ' Visual Basic .NET Fundamentals' - thor-schroeder


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

Objectives
Objectives

  • Use primitive data types, naming conventions, and style rules

  • Understand and apply the control structures supported in Visual Basic .NET

  • Explain the objects and techniques involved in the creation of a Multiple Document Interface (MDI) application

  • Understand the purpose and uses of these new Windows Forms controls: TabControl, ComboBox, CheckBox, GroupBox, and RadioButton


Using primitive data types naming conventions and style rules
Using Primitive Data Types, Naming Conventions, and Style Rules

  • Data Types

    • Literal

      • Has the face value of each occurrence

    • Constant

      • Is assigned a literal value that does not change

    • Variable

      • Is a symbolic reference to an address in memory

      • Values stored memory block can change during program execution

  • Naming Conventions

    • Facilitate program readability, understandability, and maintainability

    • Programmer-supplied names must be meaningful

    • Variable names are mixed case and consist of a prefix and a meaningful name


Using primitive data types naming conventions and style rules continued
Using Primitive Data Types, Naming Conventions, and Style Rules (Continued)

  • Example variable declarations

    • Dim mdecInterestRate As Decimal - A module-level decimal

    • Public pastructUser - A public array of structures

    • Static stintLineCtr - A static integer

    • Dim strMessage - A dynamic local string

  • Naming constants

    • Const DAYSINWEEK = 7

  • Naming functions

    • Private Function GetNextRecord()

    • Public Sub FindLastName()

    • Protected Sub EnableDisableTextboxes(vbln As Boolean)

  • Naming classes

    • Public Class Student

    • Public Class AcademicProgram

  • Naming controls

    • Controls have a prefix indicating the control’s class


Coding conventions and style rules
Coding Conventions and Style Rules Rules (Continued)

  • Purpose: to increase code readability, and, therefore, make it easier to revise and debug

  • Using indentation

    • To visually identify groups of related statements

  • Declaring variables at the lowest level

    • If variable needed only inside a procedure, declare it inside that procedure

    • If variable needed only in one form, declare it at form level in that form

    • If a variable is needed only inside a standard module, declare it as a Private variable inside that module

  • Using constants

    • Use constants rather than numeric values when possible

    • Constants improve program readability and also facilitate program maintenance

  • Writing code that is easy to read

    • Try to write code that is easy to read, follow, and understand


Control structures and structured programming
Control Structures and Structured Programming Rules (Continued)

  • Control structure

    • A method of controlling the execution sequence of instructions at runtime

  • Characteristics of structured programs

    • Limited to sequence, selection, and iteration, with unlimited nesting

    • Every procedure has a single entry point and a single exit point

    • Using stepwise refinement, programs are broken down logically or functionally into relatively small blocks of code

    • Variables are declared at lowest possible level

    • Global variables are used minimally, if at all

  • Stub

    • A placeholder for a section of code that will be developed later


Visual basic net control structures
Visual Basic .NET Control Structures Rules (Continued)

  • Sequence structure

    • One statement after another

  • Selection structure

    • Includes the If statement, Select Case statement, Immediate If function, and Try statement

  • Iteration structures

    • Provide for the repeated execution of a statement block

  • If statement

    • Allows you to specify a condition or test, and if that condition is met, to then execute one or more imperative statements


Logical operators
Logical Operators Rules (Continued)

  • And

    • The result is True only when condition A and conditionB are both True

  • Or

    • The result is True if at least one of conditionA or conditionB is True

  • AndAlso

    • The result is True only when conditionA and conditionB are both True

  • OrElse

    • The result is True if at least one of conditionA or conditionB is True

  • Xor

    • The result is True only when one and only one of conditionA and conditionB is True



Visual basic net control structures continued
Visual Basic .NET Control Structures (Continued) Rules (Continued)

  • Select case

    • Useful when the evaluation of a single expression can determine multiple paths

  • Immediate If (IIf)

    • Examines <condition> and returns <resultA> if the condition is True; otherwise, it returns <resultB>

    • Syntax:<variable> = IIf(<condition>, <resultA>, <resultB>)

  • Try … Catch … Finally

    • Provides a structured programming solution to the problem of error trapping

  • Do loops

    • Principal form of externally controlled loops

    • Pretest loop

    • Posttest loop

    • While test

    • Until test


For loop
For Loop Rules (Continued)

  • Internally controlled loop

  • Requires

    • Loop control variable (LCV)

    • Initial value for the LCV

    • Limit value for the LCV

    • Step value

    • Test to determine whether the LCV’s limit value has been reached (after which the loop is exited)



ad