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”

Slides:



Advertisements
Similar presentations
Working with Intrinsic Controls and ActiveX Controls
Advertisements

CS0004: Introduction to Programming Visual Studio 2010 and Controls.
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Creating Custom Reports. 2 Design and create a custom report You can easily create custom reports based on a table or query. There are seven sections.
Customizing Reports. Custom Reports A report is a formatted hardcopy of the contents of one or more tables from a database. Although you can format and.
XP New Perspectives on Microsoft Access 2002 Tutorial 61 Microsoft Access 2002 Tutorial 6 – Creating Custom Reports.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
XP New Perspectives on Microsoft Office Word 2003 Tutorial 1 1 Microsoft Office Word 2003 Tutorial 1 – Creating a Document.
XP 1 Microsoft Office Word 2003 Tutorial 1 – Creating a Document.
Intro to Microsoft Word.
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
InDesign CS3 Lesson 3 Working with Frames. Using Frames Frames are containers in which you place graphics or text. Frames can also be used as graphic.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Controls General Discussion. VB Controls Visual Basic Controls A control is the generic name for any object placed on a form Controls may be images,
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Visual Basic Chapter 1 Mr. Wangler.
Lesson 1 – Microsoft Excel The goal of this lesson is for students to successfully explore and describe the Excel window and to create a new worksheet.
05/09/ Introducing Visual Basic Sequence Programming.
Hello World In C++ and Microsoft Visual C++. Directions to begin a project 1. Go to All Programs 2. Open Visual Studio C++ 3. Click on New Project 4.
Microsoft Office Word 2003 Tutorial 1 Creating a Document.
Chapter 1 P. 1 Writing Windows applications with Visual Basic Figure 1.1 The first program works as follows: (These operations can be performed in any.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Teacher: Ms. Olifer MICROSOFT VISUAL STUDIO 2010: PROPERTIES OF WINDOWS FORM OBJECT.
XP 1 Microsoft Word 2002 Tutorial 1 – Creating a Document.
Introduction to Visual Basic.NET Chapter 2 Introduction to Controls, Events.
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Productivity Programs Common Features and Commands.
Format the Presentation. Selecting and Deselecting Objects 1.An object cannot be manipulated until it is selected. 2.Select various objects on PowerPoint.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Introduction to Visual Basic.NET Your First Visual Basic.NET Application.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
Chapter Two Creating a First Project in Visual Basic.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
More User Interface Controls User interface controls are located in the toolbox. Click the +/- signs to open/ close the different tabs of the tollbox.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 2 More Controls.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
COMPUTER PROGRAMMING I 3.02 Apply Properties Associated with the Controls.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Visual Basic A Quick Tutorial VB Review for ACS 367.
The Program Editor1 Visual Basic (VB) supports a text editor (not a word processor) that permits the writing and modification of program code. The editor.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
MICROSOFT WORD PRESENTATION. Word Processing  Software that is designed for the entry, editing, and printing of documents.  Windows Version = Microsoft.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
MS WORD INFORMATION TECHNOLOGY MANAGEMENT SERVICE Training & Research Division.
COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
Visual Basic.NET Windows Programming
Chapter 1: An Introduction to Visual Basic 2015
Computer Programming I
Tutorial 1 – Creating a Document
Variables and Arithmetic Operations
Lesson 5 Formatting a Presentation
Lesson 5 Formatting a Presentation
Lesson 5 Formatting a Presentation
Lesson 5 Formatting a Presentation
Lesson 5 Formatting a Presentation
Introduction to Programming
Presentation transcript:

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” tool terminates a program

The Forms Editor u Like the Program Editor, the Forms Editor allows the user to modify the properties of forms, the sort of object that may be placed on a form and the location, properties and size of these objects. u Most of these commands are highly intuitive and do not need much in the way of instruction. u There are, however, a few additional commands in the Forms Editor that are less intuitive.

Grouping Objects u On the form several objects can be selected at the same time. Do this by clicking on the desired objects while holding the Shift Key down. Here the last command selected was “cmdcompute”.

Resizing Objects u Once several objects have been selected they may be “gang” adjusted by using the “format” menu u One of the options permits resizing all selected objects to match the last one selected.

Other Commands u Dragging all tagged objects without disturbing their relative locations. u Changing justification of all text. u Changing Font and size of all text. u Changing the visibility of all tagged objects u Changing the spacing (vertical, horizontal or both) of all tagged objects. u Aligning all tagged objects.

To Learn More... u Use the search term “Format Command” in the help system to get more detailed data. (note: Format is such a common term that you must limit your search.)

The Program Editor u Visual Basic (VB) supports a text editor (not a word processor) that permits the writing and modification of program code. u The editor is one of two sub-windows that appears in the Workspace. The other is the Forms window. u Many of the commands used in the editor are like those used in word processors, but there are differences.

Entering the Editor u The editor is normally entered by “double clicking” on an “Event Producing Object” in the workspace. u The result is a code window which opens with the “subroutine” describing that event as the focus.

Line Completion Help (1) u When a line is being entered, the editor will make suggestions. u When changing the caption on the button “cmdthingie” the editor presents suggestions when you add the “dot”.

Line Completion Help (2) u I actually typed: cmdthingie.cap=”start   (no capitals, only part of the word caption, no spaces at all and no closing quote. The  represents the.) u The editor did the rest.

Line Completion Help (3) u When I typed a syntactically incorrect line, the line turned red, and a notice box was posted as soon as I struck the key or moved the cursor to a different line.

Line Completion Help (4) u When I completed the line by typing the “)” the line turned black again and was correctly spaced. u Note I had typed no spaces.

Line Completion Help (5) u If I had typed: cmdthingee. The editor would not have provided any help since I had no existing data object named “cmdthingee”.

Line Completion Help (6) u If I had completed the line anyhow and run the program, only then would the system be able to find this more complex syntactical error.

The Helpful Program Editor u The Program Editor will correctly capitalize the names of existing data objects and legally spelled system commands. If you misspell one of them things remain in lower case. u The Program Editor will suggest and complete the spelling of properties of data objects. It will insert appropriate spaces and complete the lines of correctly entered command lines.

The Long and the Short of It u Some lines of code that are too long to fit neatly on a printed line  These lines can be entered on multiple lines u Some are so short that they need only a few characters to print  One line can hold multiple statements

One statement on multiple lines Dim strThing As String strThing = "This is text that " _ & “is too long to fit on one line.“ u The underscore “_” character on the first line indicates continuation u the ampersand “&” character concatenates

One statement on multiple lines Dim sngVolume as Single, _ sngRadius as Single, sngHeight _ as Single sngVolume = * sngRadius _ ^ 2 * sngHeight ( You can place the underscore wherever a space may go, except within a quotation.)

Multiple statements on one line Dim intRed As Byte, intBlue As Byte intRed = 3: intBlue = 4 Note the two commands on the second line separated by the colon “:” character. This would work just as if the two commands were put on two separate lines. Use whatever makes the program read more easily.

Option Explicit To force VB to require all variables be defined, first click on the “option” sub- option of the “tools” command.

Option Explicit Then be sure to check the box “require variable declaration” on the revealed “option” menu.

Option Explicit u You can, equivalently, simply type option explicit at the top of the code

Some Common Controls

The Command Control u The command control is one of the most important tools in the toolbox u Double clicking on the command button icon will install a command button on the working form

Adding a Command Button u The command buttons are named, by default Command1, Command2, etc. u They may be moved or changed in size using the mouse

Properties of Command Buttons u Each command button has several properties. govern the button’s appearance and behavior u The most important are the (name) and the caption  (name) is how a programmer can refer to the button in VB code  caption is the text a user will see displayed inside the button

Highlighting a Property u When you highlight a property, its definition appears below the properties window

Names and Captions  Clicking on the (name) property lets us name it “ cmdstop ”, (note the name starts with “cmd”) u Changing the caption to “Stop” gives the user an idea as to the button’s function

Programming Convention u Good practice in Visual Basic suggests that we should name all objects in a program with names that indicate their function  These names are invariant during a program’s execution and are seen only by programmers  Command buttons names should begin with the prefix “cmd”  Names should begin with the prefix for the given object type, and should contain only letters and numbers u Captions are used to convey information to the user  They can change as the program runs  They may contain any letters, numbers, spaces, etc.

Entering Event Code  Double clicking on the “ cmdstop ” button itself, causes the Code window to open  The VB commands the define the button’s function go here  The “End” command terminates the VB program

The Label Control u The label control is an object with 37 named Properties. u You can adjust its size and position with the mouse. u You can change its (name) its caption and visibility using the Properties window.

Label Control Properties

Using Labels u The label control is usable only for output  It cannot accept input from the user u Its size, shape, color, visibility and the form of the information presented can be controlled  By editing its properties  By writing VB code to change its properties u Labels can be sized and moved using the mouse.

A Program Using a Label

Using a Label  When program execution begins, the system starts as in “A”, when the cmdby button is pressed the system goes to “B”  Repeated pressing of the cmdby button bounces the system between the two states

Programming Convention  Labels should be given a (name) that begins with “ lbl ”. u The Caption property of a label may be anything that makes sense; one or more words or symbols.  Caption is displayed for the user  (name) is only accessible to the programmer u The Visible property may be either True or False  If false, the label is not displayed

The Text Box Control u Labels are designed to be used for output u Command buttons can accept input from the user, but only of a limited nature u The text box control allows the user input data

Text Box Properties u The text property contains the string of text displayed by the text box u Unlike labels, by default this text can be edited by the user at runtime u The proper prefix for text box names is txt