Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.

Slides:



Advertisements
Similar presentations
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Advertisements

CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Compunet Corporation Programming with Visual Studio.NET GUI Week 13 Tariq Aziz and Kevin Jones.
CVEV 118/698 Visual Basic Lecture 1 Prof. Mounir Mabsout Expert 1: Elsa Sulukdjian Expert 2: Walid El Asmar.
5.05 Apply Looping Structures
Instructor: Adil Ibrahim Office: 212 Ullrich Phone: ibrahima 1.
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
CS 2340: Programming in VB Instructor: Dr. Qi Yang Office: 213 Ullrich Phone: YangQ 1.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
CS 2340 Programming in VB.NET Instructor: Dr. Qi Yang Office: 213 Ullrich Phone: YangQ 1.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Tutorial 11 Using and Writing Visual Basic for Applications Code
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Chapter 4: The Selection Process in Visual Basic.
Introduction to Visual Basic.NET Chapter 2 Introduction to Controls, Events.
Copyright © 2001 by Wiley. All rights reserved. Chapter 4: The Selection Process in Visual Basic Selection Process Two Alternative Structure If..Then..ElseIf.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2008 CHAPTER TWELVE Cell Phone Applications and Web Services.
Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly.
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
Tutorial 6 The Repetition Structure
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
CS0004: Introduction to Programming Project 1 – Lessons Learned.
Applications Development
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
3.2 VB.NET Events An Event Procedure Properties and Event Procedures of the Form Tab Order of Controls Exercises.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
CSC 157 (Blum)1 Hello World. CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
1 Advanced Computer Programming Lab Calculator Project.
4-1 Chapter 4 The Selection Process in VB.NET. 4-2 Learning Objectives Understand the importance of the selection process in programming. Describe the.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
31/01/ Selection If selection construct.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3.
Visual Basic.NET Programming for the Rest of Us Keith Mulbery Utah Valley State College.
CIS 338: Events Dr. Ralph D. Westfall April, 2011.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Computer Science Up Down Controls, Decisions and Random Numbers.
Visual Basic Fundamental Concepts
A variable is a name for a value stored in memory.
Tutorial 10 – Class Average Application Introducing the Do…Loop While and Do…Loop Until Repetition Statements Outline Test-Driving the Class Average.
3.01 Apply Controls Associated With Visual Studio Form
Introduction to VB6 Week 1 3/2/2004 PPCC - Introduction to VB6
3.01 Apply Controls Associated With Visual Studio Form
3rd prep. – 2nd Term MOE Book Questions.
Introduction to VB programming
Variables and Arithmetic Operations
Visual Basic..
Department Array in Visual Basic
CIS16 Application Development Programming with Visual Basic
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
GUI Programming in Visual Studio .NET
Presentation transcript:

Visual Basic Fundamental Concepts

Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox from which controls can be selected & placed on form. Features intellisense which prompts for completion of statement or object reference. Provides immediate syntax checking. Provides online debugging, displaying intermediate values. Provides HELP feature.

Toolbox and Controls Label control Textbox control Button control Toolbox

Basic Controls Label : Displays information through its Text property. Textbox : Information Entry, Display, and Transfer through its Text Property. Use name of textbox to access information or respond to Gotfocus event. Button : Information Display through its Text Property. Use name of button to respond with subroutine to its Click event.

Event Driven Programming Before event driven programs, typical applications were executed by the computer under control of the application. With event driven programs, the operating system detects user interactions (mouse click, tab key, etc.), passes them to the application, and a control responds by running a subprogram.

Controls and Associated Events ControlEvent FormLoad event occurs when form is loaded into computer memory ButtonClick event occurs when user clicks button with mouse TextboxLostfocus event occurs when user tabs out of box

Click event for Avg button Private Sub cmdAvg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAvg.Click 'Compute average and store in text property of tbAvg control tbAvg.Text = (CInt(tbNum1.Text) + CInt(tbNum2.Text)) / 2 tbNum1.Select() tbNum1.SelectionStart = 0 tbNum1.SelectionLength = tbNum1.Text.Length tbNum2.Clear() lblStep1.Visible = True lblStep2.Visible = False End Sub

Variables and Data Types Variables are assigned values from a data type VB data types include String, Integer, Double, and Boolean A Dim statement is used to declare a variable and the data type from which its values are assigned

Syntax of Dim and Assignment Statements Dim – Dim as Dim avg as double Dim nmbr as integer Dim flag as boolean Assignment – = avg = (nmbr1 + nmbr2) / 2 flag = false

Variables and Assignment Statements Dim message As String ‘declares string variable 'Assign string constant to messages 1 and 2 ‘ Assignment statement : = message = "Enter numbers to be “ & _ “averaged in 1st and 2nd textboxes“ lblStep1.Text = message message = "Click Average button" lblStep2.Text = message

Creating a New Project Open Visual Studio 2005 Click Project after Create:

Choosing Project Language, Template, and Project Name Select Visual Basic – Windows Windows Application Enter Project Name (Lab1 in example) Click OK

View Startup Form and Set Properties

Problem Analysis & Application Development Analyze Problem – Example : Find averages of pairs of numbers, number1 and number2 – Input : number1, number2 – Process : average = (number1 + number2) / 2 – Output : average

Project Implementation & Software Development Design Solution – Choose forms and controls Select label – textbox pairs for – Input : number1 and number2 and – Output : average Select buttons to launch processes – Average Write code to implement process Gets number1 and number2 values Computes average = (number1 + number2) /2 Displays average

Select Label Control from Toolbox Click on Form to position Label – drag if desired. Click on Textbox Control from Toolbox Click on Form to position Textbox to right of Label

Name textbox tbNumber1 Holding shift key down, select label and textbox together Copy with Ctrl-C Paste with Ctrl-V (for Number2 entry. Select button Control and position below label – textbox pair Paste again below button for output. Set text properties of labels and the button Name textbox and button controls Write code for button click event – double click on button to generate subroutine shell Label – textbox pair Copy with Ctrl-C

Controls after selection Now set text properties of labels and the button Name textbox and button controls Write code for button click event – double click on button to generate subroutine shell

Controls after setting text properties of labels and the button Name textbox and button controls Name of textbox for output Write code for button click even by double clicking button Button code should Compute & display average Clear input boxes and select first box

Write code for button click event by double clicking button Button code performs following: Computes average Displays average Clears input boxes and selects first box

Test Program in debugger by switching back to design view Click debugger button

Copy Screen to Copy Buffer by doing a Print Screen Paste onto a Word Document Type your name & turn in.

Data types and Statement Types Data Type Values Statement Type Syntax Integer 3, 211, -42,. Declaration Dim as Double 3.17, Assignment = String “Hello”, “Bob” Selection If then End if Boolean True, False Repetition For = to Next

Controls and Associated Events ControlEvent FormLoad event occurs when form is loaded into computer memory ButtonClick event occurs when user clicks button with mouse TextboxLostfocus event occurs when user tabs out of box ListboxSelectedIndexChanged occurs when user clicks a list item with mouse

Problem Analysis & Application Development Analyze Problem – Example : Find average of list of numbers incrementally by – Keeping track of number of numbers – Keeping track of sum of numbers – Computing average after each number – Displaying numbers in a listbox

Average of List of Grades

If statement for Control If statement performs an action ( ) if a condition ( ) is true. Syntax : – If then – End if

If statement Example with Else part Syntax with Else – If then – Else – End if Example : – If hours > 40 then overtimeHours = hours – 40 – Else overtimeHours = 0 – End If