Learning VB2005 language (basics)

Slides:



Advertisements
Similar presentations
Programming in Visual Basic
Advertisements

Introduction to C Programming
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Chapter 3: Introducing the Microsoft.NET Framework and Visual Basic.NET Visual Basic.NET Programming: From Problem Analysis to Program Design.
Guide to Programming with Python Chapter Two Basic data types, Variables, and Simple I/O: The Useless Trivia Program.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Chapter 2: Variables, Operations, and Strings CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp.
1 Chapter 9 Writing, Testing, and Debugging Access Applications.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
CS0004: Introduction to Programming Variables – Strings.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Week 1 Algorithmization and Programming Languages.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
Introduction to Visual Basic Programming. Introduction Simple Program: Printing a Line of Text Another Simple Program: Adding Integers Memory Concepts.
Chapters 2 & 3. .NET Software development model that allows applications created in disparate programming languages to communicate Universal data access.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Programming with Microsoft Visual Basic th Edition
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
Chapter 3: Introducing the Microsoft.NET Framework and Visual Basic.NET Visual Basic.NET Programming: From Problem Analysis to Program Design.
CIS 338: VB Variables Dr. Ralph D. Westfall April, 2011.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are used in programs so that values can be represented with.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
Introduction to Computers
Visual Basic.NET Windows Programming
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
More about comments Review Single Line Comments The # sign is for comments. A comment is a line of text that Python won’t try to run as code. Its just.
Topics Designing a Program Input, Processing, and Output
Chapter 6 JavaScript: Introduction to Scripting
Strings CSCI 112: Programming in C.
Lecture 3: Operators, Expressions and Type Conversion
Chapter 3: Variables, Functions, Math, and Strings
Chapter 3: Variables, Functions, Math, and Strings
Chapter 2 - Introduction to C Programming
Java Primer 1: Types, Classes and Operators
Introduction to Scripting
JavaScript Syntax and Semantics
JavaScript: Functions.
Chapter 2 - Introduction to C Programming
Chapter 5 - Functions Outline 5.1 Introduction
Variables and Arithmetic Operations
Introduction to Computers
VISUAL BASIC.
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Topics Introduction to File Input and Output
Advanced Programming Lecture 02: Introduction to C# Apps
Week 9 – Lesson 1 Arrays – Character Strings
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Introducing the .NET Framework
Chapter 8 Advanced SQL.
Methods.
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Chapter 2 - Introduction to C Programming
Developing a Program.
JavaScript: Introduction to Scripting
Topics Introduction to File Input and Output
The Web Wizard’s Guide To JavaScript
Strings and Dates in JavaScript
Introduction to C Programming
Presentation transcript:

Learning VB2005 language (basics) Lecture 06 Chapter 2 Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Variables and Data Types This example shows one other ingredient in VB programming: comments. Comments are descriptive text that is ignored by the compiler. VB comments always start with an apostrophe (') and continue for the entire line. Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Assignment and Initializes Visual Basic is kind enough to let you use simple data types without initializing them. Numbers are automatically initialized to 0 and strings are initialized to an empty string (""). That means the following code will succeed in VB: Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Question..?? Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Variable Operations Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Shorthand assignment operators When dealing with strings, you can use the concatenation operator (&), which joins together two strings. Shorthand assignment operators Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Line Termination Sometimes, code statements are too long to efficiently fit on a single line. In Visual Basic, you can break a code statement over multiple lines by adding (an underscore) (after Space) Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Advanced Math To use the math operations, you invoke the methods of the Math class. These methods are shared, which means they are always available and ready to use Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Type Conversions Converting information from one data type to another is a fairly common task. For example, you might retrieve text input for a user that contains the number you want to use for a calculation. Or, you might need to take a calculated value and transform it into text you can display in a web page. Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

The problem with conversion Conversions are of two types: Widening. convert a number into a string, or a 16-bit integer into a 32-bit integer Narrowing. may or may not succeed (converting a 32-bit integer to a 16-bit integer) Widening conversions always succeed A failed narrowing conversion will lead to an unexpected runtime error. Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

The problem with conversion (Solved) Adding an Option Strict instruction to the beginning of your code files. In this case, VB will not allow automatic or implicit data type conversions if they could cause an error or lose data. Instead, you’ll need to explicitly indicate that you want to perform a conversion. To perform an explicit data type conversion in VB, you use the CType() function. This function takes two arguments. The first specifies the variable you want to convert, and the second specifies the data type you’re converting it to. Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Question..?? Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Object-Based Manipulation Every type in the .NET class library includes a ToString() method Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

The String Type The following code snippet “small piece” shows several ways to manipulate a string using the methods in the String type: Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Table 2-3 lists some useful members of the String class. P.36 Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

The DateTime and TimeSpan Types Performs three useful tasks: Extract a part of a DateTime (for example, just the year) or convert a TimeSpan to a specific representation (such as the total number of days or total number of minutes). Easily perform date and time calculations. Determine the current date and time and other information (such as the day of the week or whether the date occurs in a leap “jump” year). Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

For example, the following block of code creates a DateTime object, sets it to the current date and time. Adds a number of days. It then creates a string that indicates the year that the new date falls in (for example, 2006). Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

The next example shows how you can use a TimeSpan object to find the total number of minutes between two DateTime objects. Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Next … To-Do list P.39 - 44 Conditional Structures Loop Structures The If ... End If Block The Select Case Block Loop Structures The For ...Next Block The For Each Block The Do ... Loop Block Internet Technologies I - Lect.06 - Waleed Ibrahim Osman

Thanks Internet Technologies I - Lect.06 - Waleed Ibrahim Osman