Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.

Slides:



Advertisements
Similar presentations
CE 311 K Introduction to Computer Methods VB Controls and Events Daene C. McKinney.
Advertisements

VISUAL BASIC Visual Basic is derived from the Basic language (Beginner’s All-Purpose Symbolic Instruction Code) Visual Basic uses an event-driven programming.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Introduction to Programming
Chapter 2 –Visual Basic, Controls, and Events
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
Chapter 31 Visual Basic Controls A Form is a windows-style screen displayed by Visual Basic programs. In a form, a programmer can create objects in a form.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Visual Basic.net IDE. Integrated Development Environment.
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.
Introduction to Visual Basic Chulantha Kulasekere.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Visual Basic Chapter 1 Mr. Wangler.
Chapter 3 Working with Symbols and Interactivity.
Tutorial 11 Introduction to Visual Basic zLanguage developed for special-purpose Windows applications – 1991 zUses IDE – Integrated Development Environment.
05/09/ Introducing Visual Basic Sequence Programming.
Microsoft Visual Basic 2005: Reloaded Second Edition
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.
Teacher: Ms. Olifer MICROSOFT VISUAL STUDIO 2010: PROPERTIES OF WINDOWS FORM OBJECT.
© 2011 Delmar, Cengage Learning Chapter 3 Working with Symbols and Interactivity.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
ACCESS Part 2. OBJECTIVES  Use the Form Wizard  Create a split form  Use Form Layout View  Add fields to a form  Modify form controls  Create calculations.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 2 Creating a User Interface.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Chapter 3 Introducing Visual Basic
 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.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
Visual Basic.net Textbox & Label Controls. Textbox Naming convention (txt) Primary use (user input) Can except numeric and character values.
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”
Chapter Two Creating a First Project in Visual Basic.
Chapter 2 - VB 2008 by Schneider1 Chapter 2 –Visual Basic, Controls, and Events 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual.
Chapter 2 – Introduction to the Visual Studio .NET IDE
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
What is Visual Basic.NET? 110 B-1 e.g. a word processor doesn’t do anything until the user clicks on a button, types text... A programming language that.
Vocabulary in VB So Far. Assignment: Used to change the value of an object at run time Used to change the value of an object at run time.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
CSC 157 (Blum)1 Hello World. CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
More User Interface Controls User interface controls are located in the toolbox. Click the +/- signs to open/ close the different tabs of the tollbox.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
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.
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.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 2 - VB 2008 by Schneider1 Chapter 2 –Visual Basic, Controls, and Events 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual.
COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
Visual Basic.NET Windows Programming
Visual Studio 2010 Hello World CSC 230.
Visual Basic Code & No.: CS 218
Chapter Topics 15.1 Graphical User Interfaces
Chapter 2 – Introduction to the Visual Studio .NET IDE
1. Introduction to Visual Basic
Chapter 3 Fundamentals of Programming in Visual Basic 3
Visual Studio 2010 Hello World CSC 230.
CIS16 Application Development Programming with Visual Basic
Building an Application in the Visual Basic .NET Environment
Chapter 15: GUI Applications & Event-Driven Programming
Introduction to Programming
Introduction to Visual Basic 2010
Presentation transcript:

Basic Controls & Properties Chapter 2

Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting Properties with Code

The Visual Basic IDE

The Workspace & Toolbox

Selecting Tools u Using the toolbox and the Workspace Window you can build a form that has nearly any desired appearance  Double click on an icon in the toolbox to create a new instance of that type of object in your workspace  These objects are called controls  Using the mouse, a control can be resized or moved

The Project Window u This window allows you to select and open one or more forms that are used in a given project.

u You may use this window to adjust the position of the form on the CRT screen. u Clicking on the “X” will close this window and leave room for other things. The Form Layout Window

u This window allows you to examine and modify the various properties of control objects in a program  Properties govern the appearance and behavior of a control object  They may be modified using the properties window, or by VB code The Properties Window

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 Command Button

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

Naming 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.

Command Buttons & 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 program 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 program 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.

Entering Event Code  Double clicking on the “ cmdStop ” button itself, causes the Code window to open  The VB commands that 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

Naming 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

3. 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 u Text boxes do not have Caption property!

4. The Picture Box u The Picture box control can be used to display a picture on the form u The proper prefix for picture box names is pct u Click on its Picture property  A command button with an ellipsis (…) will be displayed  By clicking on the button, a dialog box will appear to select the graphic file to display within the picture box control