Chapter 3 – Fundamentals of Programming in VB.NET VB.NET Controls VB.NET Events Numbers Strings Input and Output.

Slides:



Advertisements
Similar presentations
Chapter 2 –Visual Basic, Controls, and Events
Advertisements

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
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.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
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.
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.
1 INF110 Visual Basic Programming AUBG Spring semester 2011 Reference books: Schneider D., An Introduction to Programming Using Visual Basic, Prentice.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Visual Basic Chapter 1 Mr. Wangler.
CS0004: Introduction to Programming Variables – Numbers.
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.
Chapter 8: Writing Graphical User Interfaces
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
Tutorial 1: An Introduction to Visual Basic.NET1 Tutorial 1 An Introduction to Visual Basic.NET.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Teacher: Ms. Olifer MICROSOFT VISUAL STUDIO 2010: PROPERTIES OF WINDOWS FORM OBJECT.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
R EVIEW OF C HAPTER 1 1. Trouble installing/accessing Visual Studio? 2.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
Chapter 3 - VB.NET by Schneider1 Chapter 3 – Fundamentals of Programming in VB.NET VB.NET Controls VB.NET Events Numbers Strings Input and Output.
Chapter 3 - VB 2005 by Schneider1 Chapter 3 – Fundamentals of Programming in Visual Basic 3.1 Visual Basic Controls 3.2 Visual Basic Events 3.3 Numbers.
Chapter 8: Writing Graphical User Interfaces Visual Basic.NET Programming: From Problem Analysis to Program Design.
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.
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.
Chapter 6 Sub Procedures
Chapter 2 –Visual Basic, Controls, and Events
Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly.
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
Tutorial 6 The Repetition Structure
Chapter Two Creating a First Project in Visual Basic.
CIS 338: Classes and Modules Dr. Ralph D. Westfall May, 2011.
1 Chapter 3 – Fundamentals of Programming in Visual Basic 3.1 Visual Basic Controls 3.2 Visual Basic Events 3.3 Numbers 3.4 Strings 3.5 Input and Output.
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.
Controls. Adding Controls to Form -You can pick controls from the toolbox. -To add the controls from Toolbox to the Form You have be in design view. -To.
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.
Chapter 3 - VB.NET by Schneider1 Chapter 3 – Fundamentals of Programming in VB.NET Part I VB.NET Controls VB.NET Events.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
Chapter 31 Fundamentals of Programming in Visual Basic (VB) Visual Basic Events Simple Statement.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Chapter 31 Fundamentals of Programming in Visual Basic (VB) Visual Basic Events Simple Statement.
 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.
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.
Introduction to Computer CC111 Week 10 Visual Basic 3 1.
ALMAJMA'AH UNIVERSITY College of Science and Humanitarians Studies in Alghat Information Technology Section (211Tal course) 1.
Chapter 1: An Introduction to Visual Basic .NET
Chapter 3 – Fundamentals of Programming in Visual Basic
Chapter 1: An Introduction to Visual Basic 2015
IS 350 Course Introduction
Chapter 8: Writing Graphical User Interfaces
Do Now: What are the three steps to writing a Visual Basic Program?
Chapter 3 Fundamentals of Programming in Visual Basic 3
Variables and Arithmetic Operations
Fundamentals of Programming in VB.NET
Building an Application in the Visual Basic .NET Environment
Project Design, Forms and Buttons
Fundamentals of Programming in VB.Net
Introduction to Programming
GUI Programming in Visual Studio .NET
Presentation transcript:

Chapter 3 – Fundamentals of Programming in VB.NET VB.NET Controls VB.NET Events Numbers Strings Input and Output

3.1 VB.NET Controls Invoking VB.NET A Text Box Walkthrough A Button Walkthrough A Label Walkthrough A List Box Walkthrough The Name Property A Help Walkthrough Fonts / Auto Hide

Invoking VB.NET

Create a New Project

Initial VB.NET Screen

A Text Box Walkthrough In the ToolBox, double click the Text Box icon The control is selected when you see the sizing handles Press the Del key to delete

Text Box Properties Categorized view Alphabetical view

Changing Properties

ForeColor Property

Font Property

A Button Walkthrough Add the button Change the Text property

Add an "access key"

A Label Walkthrough Add the Label Change the Text property Resize the control

A List Box Walkthrough Add the List Box Change the Text property Resize the control

The Name Property How the programmer refers to a control in code Name must begin with a letter Must be less than 215 characters long May include numbers and the underscore Use appropriate 3 character naming prefix

Control Name Prefixes

Fonts Proportional width fonts take up less space for "I" than for "W" – like Microsoft Sans Serif Fixed-width fonts take up the same amount of space for each character – like Courier New Fixed-width fonts are good for tables

Auto Hide Hides tool windows when not in use Vertical push pin icon indicates auto hide is disabled Click the push pin to make it horizontal and enable auto hide

3.2 VB.NET Events An Event Procedure Walkthrough Properties and Event Procedures of the Form The Declaration Statement of an Event Procedure

An Event Procedure Walkthrough An event is an action, such as the user clicking on a button Usually, nothing happens until the user does something and generates an event

The three steps in creating a VB.NET program: 1.Create the interface; that is, generate, position, and size the objects. 2.Set properties; that is, configure the appearance of the objects. 3.Write the code that executes when events occur.

Changing Properties Properties are changed in code with the following: controlName.property = setting This is an assignment statement txtBox.ForeColor = Color.Red

Event Procedures Private Sub objectName_event(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles objectName.event Shown in the book as: Private Sub objectName_event(…) Handles objectName.event

Structure of an Event Procedure Private Sub objectName_event(...) Handles objectName.event statements End Sub

Program Region

IntelliSense Automatically pops up to give the programmer help.

Code for Walkthrough Private Sub txtFirst_TextChanged(...) Handles txtFirst.TextChanged txtFirst.ForeColor = Color.Blue End Sub Private Sub btnRed_Click(...) Handles btnRed.Click txtFirst.ForeColor = Color.Red End Sub Private Sub txtFirst_Leave(...) Handles txtFirst.Leave txtFirst.ForeColor = Color.Black End Sub

Assigning properties in code The following won't work: Form1.Text = "Demonstration" The form is referred to by the keyword Me. Me.Text = "Demonstration"

The Declaration Statement of an Event Procedure A declaration statement for an event procedure: Private Sub btnOne_Click(...) Handles btnOne.Click The name can be changed at will. For example Private Sub ButtonPushed(...) Handles btnOne.Click Handling more than one event: Private Sub ButtonPushed(...) Handles btnOne.Click, btnTwo.Click

3.3 Numbers Arithmetic Operations Variables Incrementing the Value of a Variable Built-In Functions: –Math.Sqrt –Int –Math.Round