170 likes | 269 Vues
VISUAL BASIC 5.0 INTRODUCTION. Version Date: August 31, 1998. VB General Information. VB is an event-driven (-oriented) language A “Form” is a container for other forms and controls. Each form is an object (instance) and also a window.
E N D
VISUAL BASIC 5.0 INTRODUCTION Version Date: August 31, 1998
VB General Information • VB is an event-driven (-oriented) language • A “Form” is a container for other forms and controls. Each form is an object (instance) and also a window. • A “Control” is an object that is attached to a form. Controls include: text box, check box, option button, command button, label, etc. • The Toolbox contains objects to be used as necessary to satisfy your requirements.
Form • Control • Toolbox • Properties
Properties, Methods, Events, Statements, and Instructions • A PROPERTY is a named attribute of an object (a noun). • Properties change an object’s appearance or behavior • Syntax: object.property = value • Examples: • cmdUpdateButton.ForeColor = vbBlue • cmdUpdateButton.FontBold = True
Properties, Methods, Events, Statements, and Instructions • A METHOD is a RESERVED KEYWORD that acts on a particular object. Methods are built into the VB language. • Syntax: object.method • Examples: frmSignon.Close frm.Signon.Move .Show .Arrange .Clear etc….
Properties, Methods, Events, Statements, and Instructions • An EVENT is an action recognized by an object • A typical event is a “key press” or “mouse click” • Properties can be “set”, methods can be “specified”, and an event typically requires a set of programmed instructions. • The VB programmer writes coded instructions to respond to events that he/she determines should be assigned to a form or a control.
Properties, Methods, Events, Statements, and Instructions • A STATEMENT is a RESERVED WORD that causes the VB program or the computer’s operating system (Win95/NT) to do something. • Syntax & Example:END and KILL • No reference to an object is required
Properties, Methods, Events, Statements, and Instructions • An INSTRUCTION is a line of VB code in a VB application. • Instructions contain the names of constants, variables, functions, properties, methods, and statements • Example ----->
A Suggested Visual Programming Development Methodology 1. Define the problem to be solved - OO Model 2. Determine file/database structure(s) 3. Determine desired conceptual outputs (screen and hard copy) 4. Determine required inputs 5. Create file/database structure(s) with sample data 6. Design and construct prototype input FORMS • VB - a) create the interface, b) set properties, c) write code 7. Test, test, test; repeat above as necessary 8. Prepare a script for your group’s presentation
VB 5 Development Environment • Forms • Controls • Focus • Reference • VB Samples - VB5 and others
VB 5 Development Environment • Visual Basic Project file types: • Project file - projectName.vbp • Form file(s) - formname.frm (frmXxxx.frm) • frmDocument.frm frmMain.frm • Module file(s) - Modulename.bas (Module1.bas) • There may be additional “data” files used by your project (examples: *.bmp, *.ico, *.mdb, etc…)
Be SURE to include YOUR NAME on the FORM!
Form Image • Code • Current Project