VB .NET Revisit VB .NET Revisit.

Slides:



Advertisements
Similar presentations
Integrated Business Applications with Databases (D3) Jenny Pedler
Advertisements

Procedural Programming in C# Chapters Objectives You will be able to: Describe the most important data types available in C#. Read numeric values.
ISOM3230 Business Applications Programming
Programming Languages and Paradigms The C Programming Language.
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
The Type System1. 2.NET Type System The type system is the part of the CLR that defines all the types that programmers can use, and allows developers.
Introduction to the C# Programming Language for the VB Programmer.
Visual Basic.NET Fundamentals. Objectives Use primitive data types, naming conventions, and style rules Understand and apply the control structures supported.
.NET Framework.NET Framework class libraries: A large set of classes that forms the basis for objects that can be used programmatically. –Programming in.
CS102 Data Types in Java CS 102 Java’s Central Casting.
VB.Net Introduction. .NET Framework.NET Framework class libraries: A large set of classes that forms the basis for objects that can be used programmatically.
IS437: Fall 2004 Instructor: Dr. Boris Jukic Data Types, Constants, Variables, Scope, Conversion.
Data Types and Operations Programming Fundamentals (Writing Code)Programming Fundamentals (Writing Code)
Review Java.
VB.Net Introduction. .NET Framework.NET Framework class libraries: A large set of classes that forms the basis for objects that can be used programmatically.
VB .NET Programming Fundamentals
VB.Net Introduction. .NET Framework.NET Framework class libraries: A large set of classes that forms the basis for objects that can be used programmatically.
VB.Net Introduction. Visual Studio 2010 Demo Start page: New project/ Open project/Recent projects Starting project: File/New Project/ –C# or VB –Windows.
VBA & Excel Barry L. Nelson IEMS 465 Fall Quarter 2003.
Visual Basic  Rick, Albert. 1. Visual Basic 1.0 (May 1991) was released for Windows at the Comdex/Windows World trade show in Atlanta, Georgia
Data Types 1.
S ystem P rogrammers' A ssociation for R esearching C omputer S ystems Visual Basic Study #1 April 01, 2004 Nam, Sedong
Dani Vainstein1 VBScript Session 9. Dani Vainstein2 What we learn last session? VBScript coding conventions. Code convention usage for constants, variables,
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 2: Chapter 3: Slide 1 Unit 2 Variables and Calculations Chapter 3 Input,
CSCI 3327 Visual Basic Chapter 4: Control Statements in Visual Basic (Part 1A) UTPA – Fall 2011.
Variable, Expressions, Statements and Operators By: Engr. Faisal ur Rehman CE-105 Fall 2007.
Tutorial C#. PLAN I. Introduction II. Example of C# program :Hello World III. How to use C# language GUI elements Primitives Types Expressions and operators.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
Microsoft Access Using Visual Basic Routines. Visual Basic Datatypes Boolean Byte Currency Date Double Integer Long Object Single String Variant Hyperlink.
Language Elements 1. Data Types 2 Floating Point (real) Single Precision Double Precision Decimal Fixed Point (integer) Byte Short Integer Long Numerical.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Applications Development
Introduction to Visual Basic Programming. Introduction Simple Program: Printing a Line of Text Another Simple Program: Adding Integers Memory Concepts.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Visual Basic.NET Preview David Stevenson Consulting Software Engineer, ABB
PseudocodeFORTRAN (original) INPUT number INPUT divisor intermediate = divisor intermediate
CIS 270—Application Development II Chapter 8—Classes and Objects: A Deeper Look.
Introduction to Programming Lecture Note - 2 Visual Basic Programming Fundamentals.
Visual Basic Programming I 56:150 Information System Design.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
VB.Net Introduction. Visual Studio 2008 It supports VB.Net, J#, C#, and C++. Demo: –Start page: Recent projects –Starting project: File/New Project/Project.
Introduction to Programming Lecture 2 Msury Mahunnah, Department of Informatics, Tallinn University of Technology.
Session 1 C# Basics.
110 E-1 Variables, Constants and Calculations(2) Chapter 3: Operations on variables, scope of a variable, formatting data Doing Arithmetic.
1 Microsoft® Visual Basic®.NET Language # 2. 2 Flow-Control Statements If … End If Select Case … End Select For… Next Do … Loop Exit.
VB.NET 2008 Introduction to Variables Part 1. Overview.NET Languages –Source Code –Compiler –MSIL –CLR & Windows Variables –Data Types –Converting.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
ILM Proprietary and Confidential -
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Data Types. Visual Basic provides data type Single for storing single-precision floating-point numbers. Data type Double requires more memory to store.
Introduction to Programming Lecture 3 Msury Mahunnah, Department of Informatics, Tallinn University of Technology.
Introduction to Programming Lecture 2
LESSON 06.
A variable is a name for a value stored in memory.
VBA - Excel VBA is Visual Basic for Applications
An Application Uses Variables to Hold Information So It May Be Manipulated, Used to Manipulate Other Information, or Remembered for Later Use.
Data Types, Arithmetic Operations
Chapter 3: Understanding C# Language Fundamentals
Chapter 2.
Module 2: Understanding C# Language Fundamentals
Unit 6 - Variables - Fundamental Data Types
VB.Net Introduction.
Intro to Programming Concepts
Review of Java Fundamentals
Presentation transcript:

VB .NET Revisit VB .NET Revisit

Software Development Life Cycle Problem Definition Requirement Analysis Systems Design Implementation Testing & Debugging Deployment Maintenance VB .NET Revisit

VB .NET .NET CLR-compliant language Event-driven Object Oriented Visual Studio .NET A Rapid Application Development (RAD) environment An Integrated Development Environment (IDE) Editor, Command Line Compiler VB .NET Revisit

Building HelloWorld with Visual Studio .NET VB .NET Revisit

Hello World - Console A Console application Imports System ‘ import System namespace Public Module Hello ‘ a Standard Module Public Sub Main() Console.WriteLine("Hello World!") End Sub End Module A Console application To compile (by command line compiler): vbc HelloWorld.vb To execute: HelloWorld.exe VB .NET Revisit

Hello World - GUI VB .NET Revisit Imports System ' import System namespace Imports System.Drawing Imports System.Windows.Forms Public Class HelloWindows Inherits Form ' inherits System.Windows.Forms.Form Private lblHelloWindows As Label Public Shared Sub Main() Application.Run(New HelloWindows()) End Sub Public Sub New() ' constructor lblHelloWindows = New Label() With lblHelloWindows .Location = New Point(37,31) .Size= New Size(392,64) .Font = New Font("Arial",36) .Text = "Hello, Windows!" .TabIndex = 0 .TextAlign = ContentAlignment.TopCenter End With Me.Text = "Visual Basic .NET" AutoScaleBaseSize = New Size(5, 13) FormBorderStyle = FormBorderStyle.FixedSingle ClientSize = New Size(466,127) Controls.Add(lblHelloWindows) End Class VB .NET Revisit

Hello World - GUI A Windows Application To compile: To execute: vbc HelloWorld2.vb /reference:System.dll,System.Drawing.dll,System.Windows.Forms.dll /target:winexe To execute: HelloWorld2.exe VB .NET Revisit

Class Public Class Student ‘ a base class … End Class Public Class FtStudent Inherits Student Dim s1 As New Student() Dim s2 As New FtStudent() s1 = s2 VB .NET Revisit

Access Modifiers Control the accessibility of types and types members (including fields, methods, etc.) Public Class SomeClass Public Sub DoSomething() End Sub Private Sub InternalHelperSub() End Class Control the accessibility of types and types members (including fields, methods, etc.) Private: accessible only from within the context in which it is declared Protected: from within the program in which it is defined and the derived classes Public: publicly accessible VB .NET Revisit

Fundamental Types Boolean Byte Short Integer Long Decimal Single Double Char String Date Object VB .NET Revisit

Variables, Literals Dim bFlag As Boolean = False Dim datToday As Date = #01/01/2005# Dim iValue As Integer Dim lValue As Long Dim shValue As Short = 128 Dim sngValue As Single Dim dblValue As Double Dim MyString As String VB .NET Revisit

Type Conversion Implicit Type Conversion: Char -> String Byte -> Short -> Integer -> Long -> Decimal -> Single -> Double Explicit Type Conversion (Casting): CByte() CShort() CInt() CLng() CDec() CSng() CDbl() CBool() CChar() CStr() CDate() VB .NET Revisit

Assignment Statements Dim a, b As SomeClass a = New SomeClass() a.MyPublicMember = “value in a” b = a b = New SomeClass() VB .NET Revisit

Operators +, -, *, / \ (integer division) Mod (modulo), 9 Mod 2 ^ (exponentiation), X^2 =, <>, <, <=, >, >=, AND, OR, NOT, XOR TypeOf …Is, TypeOf(x) Is String Is, s1 Is s2 Like, s1 Like "a*“ VB .NET Revisit

Basic I/O Module Module1 Sub Main() Dim n As Integer Dim s As String Console.Out.WriteLine("HelloWorld! What's your name?") s = Console.In.ReadLine() ‘ read in a string Console.Out.WriteLine("How old are you?") n = Console.In.ReadLine() ‘ read in a number Console.Out.WriteLine("Hi " + s + ", you're " + CStr(n) + " already.") ‘ or Console.Out.WriteLine("Hi {0}, you're {1} already.", s, n) Console.In.ReadLine() ‘ wait to press Enter End Sub End Module VB .NET Revisit

Branching Statements (1) Call SomeMethod() or SomeMethod() Exit Do, Exit For, Exit Function, Exit Sub, Exit Try If A = B Then statements End If Else ElseIf expression Then VB .NET Revisit

Branching Statements (2) Select Case strColor Case “red” … Case “green”, “blue” Case Else End Select VB .NET Revisit

Loop Do While I < 10 … Loop Do Loop Until I >= 10 For i = 0 to 4 Step 2 Console.WriteLine(i) Next For Each i in iArrary ‘ iArrary is an array For Each obj In col ‘ col is a collection Console.WriteLine(obj.ToString()) VB .NET Revisit

Array Dim a(4) As Integer For i = 0 to 4 Console.WriteLine(a(i)) Next a = New Integer(2) {} a(0) = 1 a(1) = 2 Dim a() As String = {“First”, “Second”, “Third”} Dim a(5,10) As Integer VB .NET Revisit

Enumeration Module Module1 Enum CardSuit clubs = 0 diamonds = 1 hearts = 2 spades = 3 End Enum Sub Main() Dim cs As CardSuit = CardSuit.hearts System.Console.Out.WriteLine("The value cs is {0}", cs) End Sub End Module VB .NET Revisit

Structure Module Module1 Structure PixelCoord Public x As Single Public y As Single End Structure Sub Main() Dim p As PixelCoord p.x = 200 p.y = 100 System.Console.Out.WriteLine("The value p.x is {0}", p.x) System.Console.Out.WriteLine("The value p.y is {0}", p.y) End Sub End Module VB .NET Revisit

Collection Dim col As New Collection() col.Add(“First item”) col.Add(“Second item”) col.Add(“Third item”) Dim obj As Object For Each obj In col Console.WriteLine(CType(obj, String)) Next Dim i As Integer For i = 1 to col.Count Console.WriteLine(CType(col(i), String)) VB .NET Revisit

Sub & Function Sub CheckInput() … End Sub Function Square(ByVal i as Integer) As Integer Return x End Function VB .NET Revisit