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.

Slides:



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

Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
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.
Using Visual Basic 6.0 to Create Web-Based Database Applications
CVEV 118/698 Visual Basic Lecture 1 Prof. Mounir Mabsout Expert 1: Elsa Sulukdjian Expert 2: Walid El Asmar.
Lec6 P 1 CP2030 Visual Basic For C++ programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 6 Back To Index v Procedures and Parameters.
SUNY Morrisville-Norwich Campus-Week 12 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
Using the Visual Basic Editor Visual Basic for Applications 1.
Slide 1 ICS 012 Visual Programming I Ahmed Esmat Second.
Lec2 P 1 CP2030 Visual Basic For C++ Programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 2 Back to Index v Basic Data Types v Arithmetic.
School of Computing Science – CMT1000 Slide 1 Ed Currie Introduction to Programming CMT1000 Lecture 1A.
Introduction to Visual Basic. What is Visual Basic? An environment for developing Windows applications Components –A GUI (Graphical User Interface - gooey)
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
3/9/2004 PPCC - Introduction to VB6 Copyright ©2004, Tore Bostrup 1 Introduction to VB6 Week 2.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
1 Programming Concepts Module Code : CMV6107 Class Contact Hours: 45 hours (Lecture 15 hours) (Laboratory/Tutorial 30 hours) Module Value: 1 Textbook:
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.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Visual Basic 2008 CHAPTER NINE Using Arrays and File Handling.
Microsoft Visual Basic 2005 CHAPTER 9 Using Arrays and File Handling.
1 Web-Enabled Decision Support Systems Objects and Procedures Don McLaughlin IE 423 Design of Decision Support Systems (304)
Multiple Forms, Standard Modules, And Menus
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
Using Visual Basic 6.0 to Create Web-Based Database Applications
® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.
An Introduction to Visual Basic
Using Arrays and File Handling
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
IE 411/511: Visual Programming for Industrial Applications
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
Lecture Set 1 Part C: Understanding Visual Studio and.NET – Applications, Solutions, Projects (no longer used – embedded in Lecture Set 2A)
Copyright © 2001 by Wiley. All rights reserved. Chapter 5: The Repetition Process in Visual Basic Event Driven Loops Determinate Loops Indeterminate Loops.
Introduction to the Visual Studio.NET IDE (LAB 1 )
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
SYSTEMSDESIGNANALYSIS 1 OO: Chapter 9 Visual Basic: Building Components Jerry Post Copyright © 1999.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
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”
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
University of Sunderland CIF 102/FIF102 Fundamentals of DatabasesUnit 15 Programming in Microsoft Access using VBA Using VBA to add functionality.
MS Visual Basic 6 Walter Milner. VB 6 0 Introduction –background to VB, A hello World program 1 Core language 1 –Projects, data types, variables, forms,
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Programming with Microsoft Visual Basic th Edition
110 E-1 Variables, Constants and Calculations(2) Chapter 3: Operations on variables, scope of a variable, formatting data Doing Arithmetic.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
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”
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
VISUAL BASIC 6.0 Designed by Mrinal Kanti Nath.
Unit 2 Technology Systems
Visual Basic Code & No.: CS 218
Introduction to Computer CC111
Introduction to VB6 Week 1 3/2/2004 PPCC - Introduction to VB6
Working with Forms in Visual Basic
Microsoft Access Illustrated
Using Procedures and Exception Handling
Variables and Arithmetic Operations
CS285 Introduction - Visual Basic
Tutorial 11 Using and Writing Visual Basic for Applications Code
Presentation transcript:

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 1 Lecture 1 & 2 – Introduction to the module u The VB module set u Contents and structure of this module – Review of the Visual Basic environment – Review of programming practices – Variables & Scope

Week 1 Lecture 1 Slide 2 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton CP2028 Module Aims and Objectives v Reinforce the skills and knowledge gained in VB1. v Further develop programming abilities. v Topics covered include: – storing and accessing information in files – using Databases within VB. – File handling – error handling

Week 1 Lecture 1 Slide 3 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton The Visual Basic module set. CP1007 VB1 CP2028 VB2 CP3013 App Dev in VB CP2030 VB For C++ CP1000 S.P. in C++

Week 1 Lecture 1 Slide 4 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Introduction to the Module [1] The Module Guide v The module consists of 12 weeks of study, plus a revision week. v As in VB1 the aim is to increase your skills and knowledge in program design and development. v Visual Basic is the target language, but the skills gained are applicable to other languages.

Week 1 Lecture 1 Slide 5 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Introduction to the Module [2] v Timetable details (see module guide) – 2 x 1-hour lectures per week – Tutorial – Workshop v Weekly contents v Assessments – Coursework – Exam

Week 1 Lecture 1 Slide 6 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Review of V.B. Environment v Identify the components of the VB design environment? ? ? ? ? ?

Week 1 Lecture 1 Slide 7 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Review of V.B. Environment v Identify the components of the VB design environment? Code Menu Bar ?

Week 1 Lecture 1 Slide 8 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Review of V.B. Environment v Identify the components of the VB design environment? ? ? ? ? ?

Week 1 Lecture 1 Slide 9 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Review of V.B. Environment v Identify the components of the VB design environment? Form Menu Bar Control Toolbox Project Window Properties Window

Week 1 Lecture 1 Slide 10 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Visual Basic Program Structure. v Project File – ‘.VBP’ v Form Files – ‘.FRM’ – ‘.FRX’ v Modules – ‘.BAS’ v Custom Controls – ‘.VBX’ files

Week 1 Lecture 1 Slide 11 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Control Bar - How many controls can you identify? Standard Edition Professional Edition

Week 1 Lecture 1 Slide 12 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Control bar - Properties Name Run Time Vs Design Time (Startup Defaults) Setting control positions when place on form Vs via the properties window What if we want to resize our forms do we resize controls? How? Are there tools to do it?

Week 1 Lecture 1 Slide 13 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Review of Event Driven Programming v Application program is composed of a number of subroutines, which are triggered by events within the environment. – Typical events include u Mouse-click u Keyboard use u Field value changes v Events happen to a control. – Mostly user generated events – Controls can also cause events

Week 1 Lecture 1 Slide 14 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Visual Basic Event Processing Trigger Event Code Executed

Week 1 Lecture 1 Slide 15 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Types of Events v Events can be classified as: v User generated –(e.g. command button click) v Computer generated –(e.g. specific time elapsed, from a timer control) v Program generated –(i.e. program explicitly generates an event from within the code)

Week 1 Lecture 1 Slide 16 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Visual Basic Events v The events that can happen to a control are pre- determined v Each type of control has a relevant set of events v The events that can happen to a Command Button

Week 1 Lecture 1 Slide 17 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Programming Practices v We need to consider – Control naming conventions – Variable naming conventions – Code documentation

Week 1 Lecture 1 Slide 18 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Scope of Variables v Shows declarations at form level, known as: General Declarations v Shows variable declarations within an event handler Form1 General Declarations Sub Command1_Click () Sub Command2_Click () Dim sName1 As String Dim iNum1 As Integer Dim sName2 As String Dim iNum2 As Integer Dim sName3 As String Dim iNum3 As Integer Available variables: sName1, sName2, iNum1, iNum2 Available variables: sName1, sName3, iNum1, iNum3

Week 1 Lecture 1 Slide 19 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Scope v The general rule is to declare variables at the lowest possible level. v Ie Control level Form level Module level

Week 1 Lecture 1 Slide 20 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Question Calculator Create a front end for a simple calculator, You should be able to accept two numbers and perform addition, subtraction, multiplication and division.

Week 1 Lecture 1 Slide 21 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Question calculator v Try the calculator with 5 divide 0 !!! v Why is the application not working ? v How can we correct the problem ?

Week 1 Lecture 1 Slide 22 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Solution

Week 1 Lecture 1 Slide 23 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Code

Week 1 Lecture 1 Slide 24 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton code

Week 1 Lecture 1 Slide 25 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Static Variables  A static variable will hold its value when it goes out of scope: Sub Command1_Click() 'declare variables Dim iDimCount As Integer Static iStaticCount As Integer 'increment variables iDimCount = iDimCount + 1 iStaticCount = iStaticCount + 1 'display variables Label3.Caption = Str$(iDimCount) Label4.Caption = Str$(iStaticCount) End Sub v A static variable can only be declared inside a procedure v Note the use of a comment v Note use of Str$ function

Week 1 Lecture 1 Slide 26 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton Static Variables: Effects v The effect of using a static variable can be seen below: v This is has the same effect as if the variable had been declared at the form’s general declaration level v Except the scope is local to the procedure

Week 1 Lecture 1 Slide 27 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton CP2028 Visual Basic programming 2 v Week 1 - Summary – Structure of this module and its position in the VB module set. – Review of VB environment. – Review of event-driven programming

Week 1 Lecture 1 Slide 28 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton End of Lecture Click House to Return to Main Menu