VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0...

download VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf

of 15

description

VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf

Transcript of VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0...

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    1/15

    MS Visual Basic 6

    Walter Milner

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    2/15

    VB 6 0 Introduction

    background to VB, A hello World program

    1 Core language 1 Projects, data types, variables, forms, controls , a calculator program

    2 Core language 2 Conditional statements, exception handling, loops, arrays, debugging

    3 Core language 3 Functions, sub-routines, parameter passing, modules, scope, lifetime

    4 Controls scrollbar, radio buttons, checkboxes, listboxes, timers, control arrays

    5 Graphics primitives and image files

    6 Forms Forms MDI, menus

    7 Files and databases adding controls, using data files, using databases

    8 Deployment

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    3/15

    Hello World in VB Start VB

    New Project Standard .exe Click the Button control on the ToolBox

    and drag in the form

    Double click the new button to invokethe code editor

    Enter code:

    Click the Run button

    Private Sub Command1_Click()

    MsgBox ("Hello world")

    End Sub

    Exercisetry this out

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    4/15

    What is Visual Basic?

    Kemeny and Kurtz DartmouthCollege 1964

    For students simple interpreted

    Many versions since MS VB versions more power

    not so simple

    VBScript VBA .NET framework

    RAD especially of user interface

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    5/15

    A very early version

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    6/15

    VB is not..

    Vendor independent

    Platform independent

    Based on a constant language definition

    Separated definition and IDE implementation

    Well documented

    (IMO) suitable for very large projects which must

    be maintained over a long period of time

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    7/15

    VB is .. easy to use

    suitable for RAD very marketable

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    8/15

    Building an application - steps

    Commercial data driven waterfall

    model project management

    Science/engineering underlying data and

    physical model, algorithms, testing

    In VB RAD focus on user interface

    prototyping and review.

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    9/15

    Building an application - forms

    VB uses 'form' to mean Window

    Info on form stored in a .frm file

    VB system draws form based on that info Forms can be treated like classes in OOP

    - later

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    10/15

    Building an application - controls

    Buttons, text boxes, labels, check boxes..

    VB 'control' = user interface widget

    Some invisible timer

    Controls have properties eg backgroundcolor

    Three kinds

    standard non-standard MS controls (common dialog, tab)

    and 3rdparty

    ActiveX controls written in-house

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    11/15

    Building an application - modularity

    Spaghetti programming, structuredprogramming, OOP = increasing modularity

    In VB application constructed from modules

    = files in project- Form modules

    BASIC modules

    Class modules Privateand publiccontrol interaction

    between modules

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    12/15

    Building an application - objects

    Some OOP in VB not pure OOP

    objects = things eg a form

    class = type of object eg a form design property = data value associated with

    object

    method = something the object can do

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    13/15

    Building an application example of OOP

    Dim f As Form2

    Set f = New Form2

    f.Show

    f.BackColor = RGB(255, 0, 0)

    Form2 is a class

    f is an objectan instanceof

    class Form2

    the Form2 class has amethodcalled show

    It has a propertycalled

    BackColor

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    14/15

    Event-driven programming

    Standard approach for GUIs

    Contrast with old character interfaces programdetermines what happens

    In GUI, the user triggers what application does(mostly)

    Eventexamples are key press, mouse move, timertimeouts

    Correspond to native Windows Messages (next

    slide) Event handler = a subroutine which will execute

    when that event happens

  • 5/28/2018 VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 IntroVB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro VB6 0 Intro of the huber jdjs ladkjl dsj dsal dsjaldsjaf VB6 0 Intro VB6 0 Intro VB

    15/15

    Windows Messages Spy++