Project Design, Forms and Buttons

Slides:



Advertisements
Similar presentations
VISUAL BASIC Visual Basic is derived from the Basic language (Beginner’s All-Purpose Symbolic Instruction Code) Visual Basic uses an event-driven programming.
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
Chapter 2 –Visual Basic, Controls, and Events
Compunet Corporation Programming with Visual Studio.NET GUI Week 13 Tariq Aziz and Kevin Jones.
The Initial Visual Basic Screen
Graphical User Interface (GUI) A GUI allows user to interact with a program visually. GUIs are built from GUI components. A GUI component is an object.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
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.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
Chapter 2 –Visual Basic, Controls, and Events
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 1: Chapter 2: Slide 1 Unit 1 Introduction to Programming Using VB.NET Chapter.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
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.
© 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.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Assignment #1 Advanced Computer Programming.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Chapter 3 – Fundamentals of Programming in VB.NET VB.NET Controls VB.NET Events Numbers Strings Input and Output.
Starting Out with Visual Basic.NET 2 nd Edition Chapter 2 Creating Applications With Visual Basic.NET.
Introduction to Visual Basic.NET Chapter 2 Introduction to Controls, Events.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Introduction to Visual Basic.NET Your First Visual Basic.NET Application.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Visual Basic.NET Windows Forms Hello World Homework Assignment.
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.
3.2 VB.NET Events An Event Procedure Properties and Event Procedures of the Form Tab Order of Controls Exercises.
3.9 to  Also refer to as Program  Contains set of instructions that tells the computer how to perform specific task.  Each line of code is referred.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Chapter 3 - VB.NET by Schneider1 Chapter 3 – Fundamentals of Programming in VB.NET Part I VB.NET Controls VB.NET Events.
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
IMS 3253: Forms, Controls, Properties, Events 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Program Elements Assignment.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
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: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Computer Science Up Down Controls, Decisions and Random Numbers.
Visual Basic Fundamental Concepts
Chapter 1: An Introduction to Visual Basic .NET
Visual Basic.NET Windows Programming
Visual Studio 2010 Hello World CSC 230.
Chapter 2: The Visual Studio .NET Development Environment
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Scratch for Interactivity
Chapter 1: An Introduction to Visual Basic 2015
Chapter 2 – Introduction to the Visual Studio .NET IDE
GUI Programming using Windows Form
3.01 Apply Controls Associated With Visual Studio Form
3.01 Apply Controls Associated With Visual Studio Form
EET 2259 Unit 3 Editing and Debugging VIs
Do Now: What are the three steps to writing a Visual Basic Program?
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Event Driven Programming
Visual Studio 2010 Hello World CSC 230.
Visual Basic..
Chapter 2 – Introduction to the Visual Studio .NET IDE
Items, Group Boxes, Check Boxes & Radio Buttons
Building an Application in the Visual Basic .NET Environment
Fundamentals of Programming in VB.Net
Introduction to Programming
STARTING OUT WITH Visual Basic 2008
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
GUI Programming in Visual Studio .NET
EET 2259 Unit 3 Editing and Debugging VIs
Presentation transcript:

Project Design, Forms and Buttons Computer Science Project Design, Forms and Buttons

Saving a Project Save All Toolbar Button

Dynamic Help For help on control properties and events, choose the ‘Members’ topic. This will give you an exhaustive list of both the properties and events associated with a particular control.

Dynamic Help It is also context sensitive. Start Visual Basic Express and start a new project. Go to the properties window. Scroll down the window displaying the form properties and click on the word BackColor. The word is highlighted. Press the <F1> key. A screen of information about the Form.BackColor property appears:

TASK: Form Properties Start a new project with just a form. Set the Height and Width property values (listed under Size in the properties window) and see their effect on form size. Resize the form and notice how those values are changed in the properties window. Set the Text property. Pick a new background color using the selection techniques discussed in Class 3. Try centering the form by changing the StartPosition property (you’ll see the effect of this once you run the project). To see the effect of the BorderStyle property, set a value (either Fixed Single or Sizable; these are the only values we’ll use in this course) and run the project.

Events Event Description The form does support events. That is, it can respond to some user interactions. Event Description Click Event executed when user clicks on the form with the mouse. Load Event executed when the form first loads into the computer’s memory. This is a good place to set initial values for various properties and other project values. FormClosing Event called when the project is ending. This is a good place to ‘clean up’ your project.

Loading an Event To locate a form event in the code window, click the Object list drop-down arrow and choose (Form1 Events). Once this is selected, you can scroll through the corresponding event procedures in the procedure list.

Button Control Buttons are used to start, pause, or end particular processes. The button is selected from the toolbox. It appears as: In Toolbox: On Form (default properties):

TASK: Button Control Start a new project. Put a button on the form. Move the button around and notice the changes in X and Y properties (listed under Location in the properties window). Resize the button and notice how Width and Height change. Set the Text property. Change BackColor and ForeColor properties. Experiment with Font, Font Style, and Size. What happens when you change the buttons Enabled Property to false? What happens when you set the Visible Property to False See Stopwatch project for last point - , it will appear ‘hazy’ and the user won’t be able to click it.

Button Events There is only one button event of interest, but it is a very important one: Event Description Click Event executed when user clicks on the button with the mouse.

Event Procedure Structure You know, by now, that event procedures are viewed in the Visual Basic Express code window. Each event procedure has the same general structure. First, there is a header line of the form: Private Sub ControlName_EventName(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ControlName.EventName This tells us we are working with a Private (only accessible from our form), Subroutine (another name for a event procedure) that is executed when the event EventName occurs for the control ControlName. The event procedure code begins following the header line.

End Sub The computer will process the first line, then the second, then all subsequent lines. Code is processed in a procedure until it reaches the event procedure footer line: End Sub

Assignment Statement The simplest, and most used, statement in BASIC is the assignment statement. It has this form: LeftSide = RightSide The symbol = is called the assignment operator. In an assignment statement, we say whatever is on the left side of the assignment statement is replaced by whatever is on the right side.

Assignment Statement ControlName.PropertyName = PropertyValue ControlName is the Name property assigned to the control, PropertyName is the property name, and PropertyValue is the new value we are assigning to PropertyName. Form1.Width = 1100 Form1.BackColor = Color.Blue Form1.Visible = False Form1.Text = “This is a caption in quotes”

Comments in Code To place a comment in your code, use the ‘Change form to blue To place a comment in your code, use the comment symbol, an apostrophe (‘). Or, you can place the comment on the same line as the assignment statement: Me.BackColor = Color.Blue ‘Makes form blue