Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.

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

Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
Using Macros and Visual Basic for Applications (VBA) with Excel
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
© by Pearson Education, Inc. All Rights Reserved. continued …
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
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)
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Slide 1 Chapter 2 Visual Basic Interface. Slide 2 Chapter 2 Windows GUI  A GUI is a graphical user interface.  The interface is what appears on the.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
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.
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 Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
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.
IE 411/511: Visual Programming for Industrial Applications
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Introduction to the Visual Studio.NET IDE (LAB 1 )
 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.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
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.
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.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.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
 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.
BBT 10 Visual Basic 03 Enrichment. Tip Before creating any files for your project, first create a new folder Save all of your files in the folder Pieces.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Object-Oriented Application Development Using VB.NET 1 Chapter 2 The Visual Studio.NET Development Environment.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 2 The Visual Basic.NET 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 Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Programming with Visual Basic.NET. Quick Links Program Code The Code Window The Event Procedure Assignment Statements Using AutoList Radio Buttons Buttons.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
3.02 APPLY PROPERTIES ASSOCIATED WITH THE CONTROLS Computer Programming I.
Visual Basic.NET Windows Programming
Chapter 1: An Introduction to Visual Basic 2015
Chapter 2 – Introduction to the Visual Studio .NET IDE
3.01 Apply Controls Associated With Visual Studio Form
3.01 Apply Controls Associated With Visual Studio Form
Using Procedures and Exception Handling
Chapter 2 Visual Basic Interface
Chapter 2 – Introduction to the Visual Studio .NET IDE
CIS16 Application Development Programming with Visual Basic
Building an Application in the Visual Basic .NET Environment
Introduction to Programming
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

Chapter 3 Introducing Visual Basic.NET

3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined classes to create the interface -We will be creating event driven applications -We are using Visual Basic.NET version 2003

3.2 The VB.NET IDE -IDE (Integrated Development Environment) -Start Page is the first thing to be loaded. -make sure projects tab is selected.

3.3 Creating a New Project -Select New Project Button -In Dialog Box -Project type: Visual Basic Project -Templates: Windows Application -Name: Descriptive (ex. Ch 3 Review 2) -Location: Corresponding folder in your files on the share drive (ex. G:\Programming\) -Parts of IDE (Visual Aide p. 14)

Ch. 3 – Review 1 -New Project -Name: Ch3 – Review 1 -Location: G:\ -New Form Name: Form1 Text: Message

3.4 The Windows Form -Use cursor to resize form accordingly -Properties (controls behavior, appearance, position, etc) -Name: Form1 (must be this for now) -Text: What is shown in Title Bar -BackColor: Changes color of Form -BackgroundImage: Sets an image as the background

3.5 The Label Control -Control Objects: get user data or display information -Label Control (displays text that can’t be changed by user) -can be added to form by dragging from toolbox or double clicking -can be moved to desired location on form by dragging

Label Properties Name: lbl + description (ex. lblMessage) Text: text to be displayed Font: click on … and control size, style, etc. TextAlign: use button to align text in label area -notice the name property (lbl stands for label and tells other programmers what type of object and information goes there)

Ch. 3 – Review 2 -New Project -Name: Ch3 – Review 2 -Location: G:\ -Add form from Review 1 -Add Label -Name: lblMessage -Text: Hello World! -Font: Bold, 20 -TextAlign: MiddleCenter -Run Program

3.6 Saving and Running an Application -All projects should be saved frequently -To run an application (click on the play button or hit F5) -During the compiling phase the software converts your program into machine code so the computer can run it.

3.7 The MainMenu Control -Add menu by dragging or double clicking the icon in the tool bar. -Adds 2 parts (the visible menu and sub-menus) -these are called menuItems -MenuItem Properties -Name: mnu + description (mnuProgram) -Text: Text to be displayed -Might have to declare the correct menu in the form

3.8 Closing & Opening a Project in VB.NET -If you are restarting VB.NET it should show the recent projects on the start screen. -If you are starting it for the first time today, you will have to choose open project from the toolbar. Then select the appropriate folder/file.

Ch. 3 Review 3 -New Project -Add Form from review 2 -Add a mainmenu from toolbox -Create menu -Name: mnuProgram -Text: Program -Create Sub - menu -Name: mnuExit -Text: Exit -Run Program -Complete Lesson 3.1 Review Worksheet

3.9 Program Code -Statement (each line of computer code) -All code has to be entered below the Inherits line but preferably below the “Windows Form Generated Code” box

3.10 The Event Procedure -Procedure is a block of code to perform a specific task -Event Handler is the type of procedure that performs the task. -Click Event (executes a task in response to a mouse click) -Adding an Event Procedure (In Code Window)\ -Choose object from left list box -Choose action from right list box

3.10 Continued -Will Create code similar to Private Sub mnuExit_Click (…) handles mnuExit.click End Sub -Private Sub indicates that only form1 can access the code and End Sub tells the computer where the procedure stops -Good Programming Style -All code for procedure needs to be indented one tab Private Sub mnuExit_Click (…) handles mnuExit.click me.Close() End Sub

Ch. 3 Review 4 -New Project -Add Form from review 3 -Create Click Event for mnuExit -Add code - Me.Close() -Run Program

3.11 Assignment Statements -Assignment Statements are used to change an objects property at runtime -format: form.object.property = value -example:me.lblMessage.Text = “Smile!” -When changing text property (all words must be in “ “)

3.12 Using AutoList -VB.NET attempts to make coding easier by using an autolist when you type in the dot (.) These autolist shows possible properties you can change -Me (is used to refer to the current form) -example: Me.lblMessage.Text = “Hello World!” -AutoLists are sometimes listed when you type an (=)

Ch 3 Review 6 -New Project -Add Form from review 4 -Add Sub Menu Smile (name: mnuSmile) -Add Sub Menu Hello World (name: mnuHelloWorld) -Create Click Event for mnuSmile -Add code to click event - Me.lblMessage.text = “Smile” -Create Click Event for mnuHelloWorld -Add code to click event - Me.lblMessage.text = “Hello World” -Run Program

3.13 RadioButton Control -For radio buttons to work correctly they must be grouped in a group box -GroupBox Control -Properties -Name: grp + Description (ex. grpLanguage) -Text: text to be shown on interface -RadioButton Control -Properties -Name: rad + description (ex. radFrench) -Text: text to be shown on interface -Checked: True/False (Shows which one to be checked at start) -When writing code for radio button they must be click events

3.14 Commenting Code -Used to explain or clarify program code -Have no effect on how computer runs application -To create a comment place a apostrophe (‘) before code -Use comments to put Project Name, Your Name, Class Period, and Date at the top of your program code

Ch. 3 Review 7 -New Project -New Form -Add 1 label (lblGreeting) -Add 1 Groupbox (grpLanguages) -Add 3 RadioButtons -(radEnglish, radFrench, radSpanish) -Add Comments to code (include name, project name, and date) -Add Click Events for all radio buttons -Add following code to appropriate Events -me.lblGreeting.text = “Hello, World” ‘English -me.lblGreeting.text = “Hola, Mundo”‘Spanish -me.lblGreeting.text = “Bonjour le Monde”‘French

3.15 Arithmetic/Numeric Expressions -Arithmetic Operators -Exponents (^) -Multiplication (*), Division (/) -Addition (+), Subtraction (-) -Normal Order of Operations Apply -ex: (Me.lblAnswer.text = * 3) -Use parentheses to control order of operations -What’s the difference??? - Me.lblAnswer.text = 12 / * 2 - Me.lblAnswer.text = “12 / * 2” 8 12 / * 2

3.16 Button Control -Common way to get selections from user -When Coding set up as a click event -Properties -Name: btn + description (ex. btnSave) -Text: text to be displayed on button

Ch 3 Review 8 -New Project -New Form -Add 4 buttons to form -btnProb1, btnProb2, btnProb3, btnProb4 -Add 4 labels to form -lblAns1,lblAns2, lblAns3, lblAns4 -Add Click Events for each button -Add following code to appropriate events -me.lblAns1.text = ^ 3 -me.lblAns2.text = 4 / me.lblAns3.text = * 2 -me.lblAns4.text = 7 – 3 +2