CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.

Slides:



Advertisements
Similar presentations
Information System Design Lab 5&6. User Interface Design.
Advertisements

Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
 2006 Pearson Education, Inc. All rights reserved Introduction to the Visual C# 2005 Express Edition IDE.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
 2002 Prentice Hall. All rights reserved. Chapter 2 - Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Overview of the Visual Studio.NET.
1 Pertemuan 02 Visual Basic Environment and Control Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
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.
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.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
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.
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
Chapter 2 More Controls Programming in C#. NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 2 The Visual Basic.NET Integrated Development Environment.
 2009 Pearson Education, Inc. All rights reserved Introduction to the Visual Basic Express 2008 IDE.
 2009 Pearson Education, Inc. All rights reserved Dive Into ® Visual C# 2008 Express.
Irwin/McGraw-Hill © The McGraw-Hill Companies, Inc., Visual Basic Projects Project Structure and VB’s Programming Tools chapter TWO.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Introduction to the Visual Studio.NET IDE (LAB 1 )
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Graphical User Interfaces 2 Tonga Institute of Higher Education.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
Chapter Two Creating a First Project in Visual Basic.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
 2006 Pearson Education, Inc. All rights reserved Introduction to the Visual C# 2005 Express Edition IDE.
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.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
CSC115 Introduction to Computer Programming Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 5.1 Test-Driving the Inventory Application.
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
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.
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic nd Edition.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 2 Creating Applications with Visual Basic.
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.
 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.
 2007 Pearson Education, Inc. All rights reserved Introduction to the Visual Basic Express 2005 IDE.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Dive Into® Visual Basic 2010 Express
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
1. Introduction to Visual Basic
3.01 Apply Controls Associated With Visual Studio Form
Introduction to the Visual C# 2005 Express Edition IDE
Chapter 2 – Introduction to the Visual Studio .NET IDE
CIS16 Application Development Programming with Visual Basic
Visual Studio.
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin 2- 2 Chapter Introduction The Integrated Development Environment (IDE) is used for modern software development. The IDE contains tools to write code, build a GUI, and test and debug applications. Overview of the application construction process. Design issues are addressed. Visual Basic.NET controls are examined. The MsgBox statement and InputBox() function are visited. A project is developed as a working application.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin 2- 3 Objectives Design and construct simple complete applications from scratch. Explain the structure of Visual Basic.NET. List the characteristics of several Visual Basic.NET controls. Identify the purpose of each major control of the Visual Basic.NET IDE. Explain basic programming practices that contribute to the readability of programs.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin From New Solution to Finished Application Overview of the Construction Process –Visual Basic.NET runs under Windows. –The programmer creates the application. –The project is an application under construction. –The application is saved to disk periodically. –An executable file is generated from the finished application program.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin 2- 5 Visual Basic.NET’s Three Modes Design Mode –Placing, arranging, and customizing the appearance of buttons, labels, and other controls on a form. –Writing processing scripts (source code). –Saving the solution. –Making an executable file.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin 2- 6 Visual Basic.NET’s Three Modes (cont.) Run Mode –Executes the solution. –Used to evaluate the workability of a part of the project. –Used to show the user how the solution will work.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin 2- 7 Visual Basic.NET’s Three Modes (cont.) Break Mode –Helps the developer with debugging. –Enables the developer to switch back to run mode or design mode.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin 2- 8 Design Time and Run Time In design mode, the project is in design time. In run mode, the project is in run time. Some errors can be found and corrected in design time. Other errors can only be detected during run time.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Overview of Controls Standard controls are used to create user- friendly applications. Standard controls help users lower the learning curve for new programs.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Categories of Controls Trigger: Initiate processing –Ex. Button, MainMenu, and Timer Input: Get data from user –Ex. TextBox, RadioButton, and CheckBox Output: Display results to user –Ex. Label, DataGrid, and ListView

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Categories of Controls (cont.) Organize: Group other controls –Ex. Form, GroupBox, and Panel Data Access: Interface with databases –Ex. Entire Data Group and DataGrid

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin The Correct Control for the Job Chose controls to satisfy user requirements. Different controls are good for different tasks. The Button, Label, and Textbox controls are introduced.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin The Visual Basic.NET Development Environment The IDE helps develops create efficient and effective solutions. The IDE for Visual Basic.NET is common to all the other tools available in the Visual Studio. NET suite.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Getting Started Open an existing project or begin a new project from the Start Page. Use the My Profile option to set up the IDE.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Visual Basic.NET Solution Structure Every application will be organized as a “solution.” Solution Explorer is an interface for viewing and managing containers and associated items. Items are files that make up your project, such as forms, source files, and classes.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Main Tools Used in Visual Basic.NET Menu Toolbar Solution Explorer Properties Editor Task List Toolbox Designer Window Code Window Help System

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Saving a Solution Save your solution and all its contents on a regular basis. Each project should be in its own separate folder. Avoid the temptation to use the Save As…, save option. Use the Save and Save All Toolbar icons.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Summary Many of the features of the Visual Basic.NET IDE have been introduced. Next, some of the controls to write simple programs will be introduced. Experimentation is encouraged. Hands-on experience is important.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Introducing the Windows Form Control The window that is displayed when the application is running. The IDE automatically creates a Windows Form when you start a new project. This form will hold or “contain” other controls.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin The Button Control React to the click of the use Perform a task associated with the name of the button that is displayed on its face.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Appearance and Use Appears as a rectangular-shaped control on a form. Its face can display text, an image, or both. The face of the button should clearly indicate its function.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Properties The most common properties of the Button control are listed. Most properties are available for every control.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Common Properties of the Button Control Name BackColor BackgroundImage Enabled Font ForeColor Image ImageAlign TabIndex TabStop Text TextAlign Visible

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Events Components are able to respond to events. The click event is generated when the user clicks the mouse button. You write code to handle events. Double-click the Button control to automatically open the code window.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin The Label Control Used to display information to the user. Used to label other controls or show results of a calculation. –Ex. Check box and radio button labels.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Appearance and Use Appears as a rectangular area that can be filled with text. You have some control over size and alignment of text. You can include a border around the label.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Properties Many of the Button control properties apply to the Label control. The Text Property is the most-used property for the Label control.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Common Properties of the Label Control Name AutoSize BorderStyle DataBindings Font ForeColor Image ImageAlign Text TextAlign

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Events Example 2.1 Using the Label Control –Demonstrates two main uses of the Label control To display a message to the user. To display “labeling” information for the user.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin The TextBox Control Provides an area for the user to type while the program runs.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Appearance and Use Displays as a rectangular area that provides the user a place to type. You can limit the user types You can also surround the TextBox with a border.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Properties Some of the TextBox control properties are only available at run time. The value of the Text property is used most frequently. Control of user entry is shared between properties and events. The PasswordChar property allows you to set a security character.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Properties (cont.) TextLength property determines the number of characters contained in a textbox. Selection… properties provide information on user selections in the TextBox control.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Common Properties of the TextBox Control Name AcceptsReturn AcceptsTab AutoSize BorderStyle CharacterCasing Font Lines MaxLength Modified Multiline PasswordChar ReadOnly ScrollBars SelectedText SelectionLength SelectionStart Text TextAlign TextLength WordWrap

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Events Focus means the user is currently working with the specific control. Enter - Occurs when input focus is received. KeyPress - Occurs when a key is pressed while the control has focus. Leave – Occurs when input focus leaves the control.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Events (cont.) Methods –Enable the developer to manipulate text in a TextBox. –Many are available to the developer.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Common Events for the TextBox Control Enter KeyPress Leave AppendText Clear Copy Cut Paste Select SelectAll Undo

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin The MsgBox Statement and InputBox Function Two alternate ways to receive information from the user and to display information on the screen.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin MsgBox Statement The MsgBox statement will display information that requires user intervention. –MsgBox(“A prompt”, Buttons,”A title”)

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin InputBox() Function The InputBox() function requests information from the user with a dialog box. It requires user intervention. –InputBox(“A prompt”,”A title”,”A default response”)

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Chapter Summary An application being developed in Visual Basic.NET is called a project. Visual Basic.NET uses three modes of operation. The Visual Basic.NET IDE contains a number of development tools. During the design phase, descriptive names should be applied to important controls.

©2002 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Chapter Summary (cont.) The Windows Form control is used to contain the other GUI controls. The Button control enables the user to trigger a process by a click event. The MsgBox statement provides an alternate means to provide information to the user. The InputBox() function provides an alternate way to receive information from the user.