CVEV 118/698 Visual Basic Lecture 1 Prof. Mounir Mabsout Expert 1: Elsa Sulukdjian Expert 2: Walid El Asmar.

Slides:



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

Working with Intrinsic Controls and ActiveX Controls
Information System Design Lab 5&6. User Interface Design.
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Visual Basic Project Files:.VBP file: Project File: a small text file that contains the names of other files in the project, as well as some information.
Introduction to Visual Basic Programming. Lecture Outline History What is Visual Basic First Look at the VB 6.0 Environment Some VB Terminology Our first.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Visual Basic Project Files:.VBP file: Project File: a small text file that contains the names of other files in the project, as well as some information.
CVEV 118/698 Visual Basic Lecture 2 Prof. Mounir Mabsout Elsa Sulukdjian Walid El Asmar.
CVEV 118/698 Visual Basic Lecture 3 Prof. Mounir Mabsout Elsa Sulukdjian Walid El Asmar.
Data Types and Operations Programming Fundamentals (Writing Code)Programming Fundamentals (Writing Code)
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
Introduction to Visual Basic. What is Visual Basic? An environment for developing Windows applications Components –A GUI (Graphical User Interface - gooey)
Introduction to Visual Basic Chulantha Kulasekere.
VBA & Excel Barry L. Nelson IEMS 465 Fall Quarter 2003.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
Microsoft Visual Basic 2008 CHAPTER NINE Using Arrays and File Handling.
Microsoft Visual Basic 2005 CHAPTER 9 Using Arrays and File Handling.
Using Visual Basic 6.0 to Create Web-Based Database Applications
An Introduction to Visual Basic
Using Arrays and File Handling
IE 411/511: Visual Programming for Industrial Applications
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Integrated Development Environment (IDE)
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Introduction to the Visual Studio.NET IDE (LAB 1 )
Access VBA Programming for Beginners - Class 2 - by Patrick Lasu
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Introduction It is developed to create software applications. It is a tool for developers of any program that uses both basic and expert settings. It.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA.
CC111 Lec7 : Visual Basic 1 Visual Basic(1) Lecture 7.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
UnitII Visual basic Controls and toolbars. What is visual basic Visual Basic (VB) is an ideal programming language for developing sophisticated professional.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Programming with Microsoft Visual Basic th Edition
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
Understanding Visual Basic Fundamentals CHAPTER 13 Understanding Visual Basic Fundamentals.
COMPUTER III. Fundamental Concepts of Programming Control Structures Sequence Selection Iteration Flowchart Construction Introduction to Visual Basic.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
Week 1 Lecture 1 Slide 1 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton CP2028 Visual Basic Programming 2 v Week.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
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.
Dive Into® Visual Basic 2010 Express
Visual Basic Fundamental Concepts
VISUAL BASIC 6.0 Designed by Mrinal Kanti Nath.
A variable is a name for a value stored in memory.
Chapter 2: The Visual Studio .NET Development Environment
VBScript Session 1 IT Professional Academy.
Visual Basic Code & No.: CS 218
Introduction to Computer CC111
1. Introduction to Visual Basic
Introduction to VB6 Week 1 3/2/2004 PPCC - Introduction to VB6
Visual Basic..
Hands-on Introduction to Visual Basic .NET
CIS16 Application Development Programming with Visual Basic
VB.NET PROGRAMMING FINAL EXAM TEST REVIEW.
CS285 Introduction - Visual Basic
Presentation transcript:

CVEV 118/698 Visual Basic Lecture 1 Prof. Mounir Mabsout Expert 1: Elsa Sulukdjian Expert 2: Walid El Asmar

Introduction Visual Studio 6.0: Collection of Microsoft Visual development applications (Visual C++, Visual J++, Visual Basic, etc…) Visual Studio 6.0: Collection of Microsoft Visual development applications (Visual C++, Visual J++, Visual Basic, etc…) VB is a programming language. 6 Versions launched since its creation in the 90’s. VB is a programming language. 6 Versions launched since its creation in the 90’s. “Easy and powerful tool for developing Windows applications in Basic.” Bill Gates. “Easy and powerful tool for developing Windows applications in Basic.” Bill Gates.

VB Development Environment Integrated Development Environment (IDE): v isual environment to develop, run, test and debug. Integrated Development Environment (IDE): v isual environment to develop, run, test and debug. Controls: generally visual, and readymade components, assigned a set of properties (I.e. Text Box, Button, List Box, etc…). Controls: generally visual, and readymade components, assigned a set of properties (I.e. Text Box, Button, List Box, etc…). IntelliSense: Microsoft’s sophisticated completion technology. It simplifies the coding process. IntelliSense: Microsoft’s sophisticated completion technology. It simplifies the coding process. Event driven programming: f low of the application dictated by the user actions (click of a mouse, keystrokes, etc…). Event driven programming: f low of the application dictated by the user actions (click of a mouse, keystrokes, etc…).

VB IDE menu bar Toolbar Project Explorer Properties window Form layout Toolbox Immediate window

VB IDE Components Menu Bar: contains all commands needed to run VB (File, Edit, View etc…). Menu Bar: contains all commands needed to run VB (File, Edit, View etc…). Toolbars: quick access to commonly used menu commands. Toolbars: quick access to commonly used menu commands. Project Explorer: displays the project’s components. Project Explorer: displays the project’s components. Toolbox: contains icons of the controls that can be placed on the project’s Forms to create the application’s interface. Toolbox: contains icons of the controls that can be placed on the project’s Forms to create the application’s interface. Properties Window: Shows the property settings of the selected control (size, caption, color, etc…). Properties Window: Shows the property settings of the selected control (size, caption, color, etc…).

VB IDE Components (Cont’d) Form Designer: Main window in which one can design and edit the application’s user interface. In this window the user can enter and edit the application’s code. It displays two windows: Form and Code window. Form Designer: Main window in which one can design and edit the application’s user interface. In this window the user can enter and edit the application’s code. It displays two windows: Form and Code window. Form Layout: Shows the initial positions of the forms in the application. It is useful in multiple forms applications. Form Layout: Shows the initial positions of the forms in the application. It is useful in multiple forms applications. Immediate Window: Debugging tool. Immediate Window: Debugging tool.

Programming Steps Step 1: Customize the windows that the user sees. I.e. placing controls and components on the layouts of the project’s Forms. Step 1: Customize the windows that the user sees. I.e. placing controls and components on the layouts of the project’s Forms. Step 2: Decide on the events each control should recognize. Step 2: Decide on the events each control should recognize. Step 3: Coding the event procedures for those events. Step 3: Coding the event procedures for those events.

Variable Declaration Visual Basic code works in two modes: Visual Basic code works in two modes: – Implicit: does not require variable declaration – Explicit: requires variable declaration Declare variables using Declare variables using Dim VariableName As DataType Example:Dim length As Integer Dim greetings As String

Variable Types Numeric: Numeric: stores numbers String: stores text Variant: stores any type of data Boolean: true/false Date Object

Implicit/Explicit Implicit Example Implicit Example Public Sub VBImplicit() x = 5 y = “Hello” End Sub Explicit Example Start code window by: Option Explicit […] Public Sub VBExplicit() Dim x As Integer, y As String x = 5 y = “Hello” End Sub Implicit: default VB mode, x and y stored as variants Implicit: default VB mode, x and y stored as variants Explicit: x can only store integers, y only strings Explicit: x can only store integers, y only strings ALWAYS use explicit mode, it reduces errors ALWAYS use explicit mode, it reduces errors

Variable Scope Sub1 Sub1 Variables Form 1 Sub2 Sub2 Variables... Form1 Variables Code Form 2 Code

Variable Scope (cont’d) Dim x As Integer Public Sub FirstSub() x = 5 Dim y As Integer End Sub Public Sub SecondSub() x = 6 Dim y As String End Sub The same variable x is needed in both subroutines and therefore is defined as a global variable (I.e. declaration outside subs) The same variable x is needed in both subroutines and therefore is defined as a global variable (I.e. declaration outside subs) There is a different local variable y for each subroutine (I.e. declaration inside subs) There is a different local variable y for each subroutine (I.e. declaration inside subs)

Variable Generalities Variable names need to be significant for clear coding practice. Don’t be shy of using long names. Usually the first character(s) indicate the variable type (e.g): – –Integer: int…Dim intLength As Integer – –String: str… – –Double: dbl… – –Text Control: txt – –Etc.

Constants Constants do not change their value during the execution of the program. Declaration: Const ConstantName As DataType Public Const pi As Double =

Arrays Arrays hold a set of related data. Declaration: Dim ArrayName(ArraySize) As DataType Dim strNames(15) As String or Dim strNames(1 To 16) As String strNames is an array that holds 16 string values. Multidimensional arrays: Dim dblTemperature(99,99) As Double

Dynamic Arrays Size not defined at the beginning of the program: Dim dblMatrix() as Double You can re-dimension the array once you know the size of the array: ReDim dblMatrix(UserCount,UserCount)

What’s Next Basic VB syntax Basic VB syntax Functions and Subroutines Functions and Subroutines Common VB controls Common VB controls