Essential Visual Basic 4.0 Fast: How to Develop Applications in Visual Basic
John Cowell · 1996
1 Why Use Visual Basic?.- Why Use Visual Basic.- Is This Book For You?.- How to Use This Book.- New Features in Version 4.- What Computer You Need to Run Visual Basic.- Conventions.- Running Visual Basic.- Starting Visual Basic.- Before you Start.- The Visual Basic Design Screen.- The Form.- The Toolbox.- The Control Properties Window.- The Project Window.- The Visual Basic Menu Bar and Toolbar.- Event-Driven Software.- Outline of the Add Program.- Creating a New Project.- Defining the User Interface.- Moving and Scaling.- The Properties Window.- Changing Captions.- Writing the Code.- Running the Program.- Using Properties.- Enabled and Name Properties.- Control Values.- Controlling Form Properties.- 2 How Projects are Organised.- The File Menu.- Application Files.- FRM Files.- BAS Files.- VBX and OCX Files.- FRX Files.- Creating and Saving Modules.- The Autoload File.- 3 The Toolbar and Menu.- The Toolbar.- Project and File Management.- Displaying Windows.- Running and Debugging Applications.- The Menu.- The Print Dialog Box.- The Edit Menu.- Finding and Replacing Text.- Image Priority.- The Tools Menu.- The View Menu.- 4 General Procedures and Dlls.- General Procedures.- Event Procedures.- The Scope of Event and General Procedures.- Using Event Procedures.- Making a New General Procedure.- Passing Arguments.- Function Procedures.- Naming Conventions.- DLLs.- Using DLLs.- Declaring a DLL.- Calling a DLL.- 5 Controls.- The Toolbox Appearance.- Common Toolbox Controls.- Command Buttons.- Labels.- Text Boxes.- Text Boxes and Passwords.- Captions and Hot Keys.- Frames.- Check Boxes.- Option Buttons.- Scroll Bars.- List Boxes.- The AddItem Method.- The Sorted Property.- Combo Boxes.- The Simple Combo Box.- The Drop-down Combo Box.- The Drop-down Combo List.- The Timer Control.- Selecting Controls.- Setting Properties of Groups.- Custom Controls.- The Common Dialog Control.- The Slider Control.- The StatusBar Control.- 6 The Insurance Quote Form.- Design of the Quote Screen.- Using Options Buttons.- Creating Check Boxes.- Creating Combo and List Boxes.- Running the Program.- Initialising the List and Combo Box.- Tablndex and TabStop.- 7 Dialog Boxes.- Creating a Message Box.- The Message Box Function.- The Message Box Statement.- Using Messages Boxes.- Message Box Text.- MsgBox Icons.- Changing MsgBox Headers.- MsgBox Buttons.- Getting Button Input.- The Input Box Function.- Specifying Default Text.- 8 Operators and Variables.- Data Types.- Range of Data Types.- Declaring Variables.- Static Variables.- Variables Scope.- Arithmetic Operations.- Integer Division.- The Mod Operator.- The Comparison Operators.- String Concatenation.- The Logical Operators.- The And Operator.- The Eqv Operator.- The Imp Operator.- The Or Operator.- The Xor Operator.- The Not Operator.- 9 Controlling Program Flow.- Types of Program Control.- The If...Then...Else Statement.- Nested Ifs.- The Else If Clause.- The Select Case Structure.- The Switch Function.- The GoTo Statement.- 10 Looping Constructs.- Types of Looping Constructions.- The Do...While Clause.- The Do...Until Clause.- Exit Do Statement.- The While...Wend Clause.- The For...Next Construct.- Terminating For Loops.- Exit For.- 11 Using Data Structures.- Arrays.- Declaring Arrays.- One-Dimensional Arrays.- Multi-Dimensional Arrays.- Re-dimensioning Arrays.- Multi Dimensional Arrays.- User-Defined Data Types.- The Erase Statement.- 12 Menus.- Using Menu Bars.- Amending the Menu.- Short-cut Keys.- Enabling and Disabling Controls.- Menu Properties.- 13 MDI Applications.- Creating an MDI Application.- Arranging Forms.- The Start-up Form.- Modal and Non-Modal Forms.- Loading and Unloading Forms.- The Hide Method.- 14 Grid Control.- Installing the Grid Control.- Creating a Grid.- Grid Properties.- Writing to the Grid.- Selecting Cells.- Adding and Removing Rows.- ColWidth and RowWidth Properties.- Aligning Text.- Scroll Bars.- Adding Text to Grids.- Confusing Row and Rows.- Editing Cell Contents.- 15 Creating Graphics.- Use of Graphics.- The Co-ordinate System.- The Image Control.- The Stretch Property.- Clipboard Images.- The PictureBox Control.- The AutoSize Property.- The Image and Picture Box Controls.- Adding a Picture at Run-Time.- Using Graphics Methods.- Controlling Individual Pixels.- Graphical Controls.- The Line Control.- Properties of the Line Control.- The Shape Control.- Properties of the Shape Control.- The Fill Style Property.- Drawing Lines.- Drawing Boxes.- Drawing Circles.- Drawing Ellipses.- Changing Units.- Using Colours.- The QBColor Function.- The RGB Function.- Assigning Colours Directly.- 16 Displaying and Printing.- Message Boxes, Text Boxes and Labels.- Controlling Fonts and Font Characteristics.- Using the Print Method.- Controlling Print Position.- Controlling Number Format.- Custom Formats.- Displaying Dates and Times.- Writing to a Printer.- The Printer Object.- The PrintForm Method.- 17 Mouse and Keyboard Events.- Mouse Events.- Mouse Event Arguments.- The Click Events.- The MouseDown, MouseUp Events.- The Button Argument.- The Shift, Ctrl and Alt Arguments.- Dragging and Dropping.- The Drag Method.- The DragIcon Property.- The DragOver Event.- Keyboard Events.- The KeyPress Event.- The KeyDown, KeyUp Events.- 18 Object Linking and Embedding (OLE).- Using OLE.- Linking and Embedding.- The OLE Control.- The OLE Pop-Up Menu.- Using Paste Special.- Creating OLE Objects at Run-Time.- OLE Update Options Property.- OLE AutoActivate Property.- OLE Verbs.- The AutoVerbMenu Property.- The Verb Property.- The ObjectVerbsCount Properties.- The Updated Event.- 19 Using Files.- Supported File Types.- Opening a File.- The FreeFile Function.- File Errors.- Closing Files.- Reading Files.- Reading ASCII Files.- Writing ASCII Files.- Copying and Deleting Files.- Random Access Files.- Using Random Access Files.- Binary Files.- The Seek Statement.- Finding Files.- The FileListBox.- The FileName Property.- Linking the Controls.- 20 Databases.- Using Databases.- Database Jargon.- Creating a Database.- Specifying Fields.- Adding an Index.- Adding Data.- The Data Control.- Connecting the Data Control.- Viewing the Database.- Bound Properties.- Properties for Data-Aware Controls.- The DataChanged Property.- The Traffic Sign Program.- Duplicating the Data Control.- Adding and Deleting Records.- Deleting a Record.- Adding a New Field to a Table.- Adding a New Table.- The Data Form Designer.- 21 Examples.- Creating a Simple Project.- Creating a Large Form.- Controlling Control Properties.- File Delete Program.- Finance Company.- Zoo Database.- Changing Text Styles.- MDI Viewer.- Creating and Using Grids.- Deleting Grid Rows.- Importing Graphics.- Drawing Pi Charts.- Printing to a Picture Box.- Printing Tabular Data.- Printing at a Specific Location Using Format.- The Scribble Program.- Using Navigation Keys.- File Handling.- Christmas Present Database.