1 Chapter Nine Using GUI Objects and the Visual Studio IDE.

Slides:



Advertisements
Similar presentations
Document Properties: adding information to your Microsoft Office documents Step 1: Add information to Document Properties What are Document Properties.
Advertisements

Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
1 Microsoft Access 2002 Tutorial 9 – Automating Tasks With Macros.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Introduction to Visual Basic Programming. Lecture Outline History What is Visual Basic First Look at the VB 6.0 Environment Some VB Terminology Our first.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Customizing Word Microsoft Office Word 2007 Illustrated Complete.
Advanced Object-Oriented Programming Features
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 13: Advanced GUI and Graphics
Introduction to Visual Basic Chulantha Kulasekere.
Creating a Console Application with Visual Studio
DT265-2 Object Oriented Software Development 2 Lecture 3 : Windows Programming Lecturer Pat Browne
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Getting Started Example ICS2O curriculum
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Chapter 8: Writing Graphical User Interfaces
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
Exploring Microsoft Office XP - Microsoft Word 2002 Chapter 71 Exploring Microsoft Word Chapter 7 The Expert User: Workgroups, Forms, Master Documents,
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
1 Chapter Eleven Handling Events. 2 Objectives Learn about delegates How to create composed delegates How to handle events How to use the built-in EventHandler.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Multiform Projects.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
1 Chapter Ten Using Controls. 2 Objectives Learn about Controls How to create a Form containing Labels How to set a Label’s Font How to add Color to a.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
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.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
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.
Object-Oriented Programming: Inheritance and Polymorphism.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
Visual Basic.Net. Software to Install Visual Studio 2005 Professional Edition (Requires Windows XP Pro) MSDN Library for Visual Studio 2005 Available.
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 C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Dialog Boxes Getting information from user. Types of Windows Five types we’ll be using 1. Main Application Window 2. Child Windows 3. Dialog Boxes 4.
Chapter 2: The Visual Studio .NET Development Environment
Chapter Topics 15.1 Graphical User Interfaces
Chapter Eleven Handling Events.
Using GUI Objects and the Visual Studio IDE
Using Procedures and Exception Handling
Hands-on Introduction to Visual Basic .NET
Object-Oriented Programming: Inheritance and Polymorphism
Chapter 15: GUI Applications & Event-Driven Programming
Presentation transcript:

1 Chapter Nine Using GUI Objects and the Visual Studio IDE

2 Objectives How to create a MessageBox How to add functionality to MessageBox buttons How to create a Form How to create a Form that is a program’s main window

3 Objectives How to place a Button on a window How to use the Visual Studio IDE to design a Form Learn about the code created by the IDE How to add functionality to a Button on a Form How to use the Visual Studio Help Search function

4 Creating a MessageBox A MessageBox is a GUI object that can contain text, buttons, and symbols that inform and instruct a user You must use the static class method Show() to display a message box, because its constructor is not public

5 Creating a MessageBox Output of MessageBox1 program

6 Creating a MessageBox There are many overloaded versions of the Show() method

7 Creating a MessageBox Arguments used with the MessageBox.Show() method

8 Adding Functionality to MessageBox Buttons DialogResult is an enumeration, or list of values that correspond to a user’s potential MessageBox button selection

9 Output of HamburgerAddition program Adding Functionality to MessageBox Buttons

10 Creating a Form Forms provides an interface for collecting, displaying, and delivering information to a user through buttons, list of options, text fields, and other controls Unlike the MessageBox class, you can create an instance of the Form class

11 Creating a Form Output of CreateForm1

12 Creating a Form You can change the appearance, size, color, and window management features of a Form by setting its instance fields or properties The Form class contains approximately 100 properties that can be used to set various configurations of the Form class The ShowDialog() method displays a form as a modal dialog box

13 Creating a Form CreateForm2 class and Output

14 Creating a Form that is a Program’s Main Window When you create a new main window, you must complete two steps: –You must derive a new custom class from the base class System.Windows.Forms.Form –You must write a Main() method that calls the Application.Run() method, and you must pass an instance of your newly created Form class as an argument

15 Creating a Form that is a Program’s Main Window Window1 class and the Window1 object

16 Creating a Form that is a Program’s Main Window When you want to add property settings to a program’s main window, you can do so within the class constructor

17 Creating a Form that is a Program’s Main Window The Window2 object

18 Placing a Button on a Window A Button is a GUI object you can click to cause some action For a Button to be clickable, you need to use the System.Windows.Forms.Control class

19 Placing a Button on a Window Output of WindowWithButton program

20 Using the Visual Studio IDE to Design a Form Using a text editor when programming and designing GUIs is a very tedious and error prone task Just determining an attractive and useful layout in which to position all components on your Form takes many lines of code and a lot of trial and error The Visual Studio IDE provides a wealth of tools to help make the Form design process easier

21 Understanding the Code Created by the IDE The automatically generated code is simply a collection of C# statements and method calls similar to the ones created by hand When you use the Designer in the IDE to design your forms, you save a lot of typing, which reduces the errors you create Because the IDE generates so much code automatically, it is often more difficult to find and correct errors in programs created using the IDE than in programs you create by hand

22 Understanding the Code Created by the IDE The code automatically generated by the IDE includes: –using statements and namespace creation –Declarations of forms and other objects –Comments –Methods and method calls

23 Adding Functionality to a Button on a Form In most cases, it is easier to design a Form using the IDE than it is to write by hand the code a Form requires Adding functionality to a Button is particularly easy using the IDE

24 Adding Functionality to a Button on a Form Selecting the source file MessageBox that appears after clicking Press

25 Adding a Second Button to a Form Forms often contain multiple Button objects; a Form can contain as many Buttons as you need Each Button has a unique identifier which allows you to provide unique methods that execute when a user clicks each Button

26 Adding a Second Button to a Form Two Buttons on a Form

27 Adding a Second Button to a Form Make a Choice Form after user clicks Sausage Button

28 Using the Visual Studio Help Search Function The ultimate authority on the classes available in C# is the Visual Studio Search facility

29 Using the Visual Studio Help Search Function Button Class documentation

30 Chapter Summary A MessageBox is a GUI object that can contain text, buttons, and symbols that inform and instruct a user. You use the static class method Show() to display a MessageBox. DialogResult is an enumeration, or list of values that correspond to a user’s potential MessageBox button selections Forms provide an interface for collecting, displaying, and delivering user information

31 Chapter Summary You can create a child class from Form that becomes the main window of an application. When you create a new main window, you must derive a new custom class from the base class System.Windows.Forms.Form, you must also write a Main() method that calls the Application.Run() method. A window is more flexible than a MessageBox because you can place manipulatable Window components where you like on the surface of the window The Visual Studio IDE provides a wealth of tools to help make the Form design process easier

32 Chapter Summary Using the Visual Studio IDE, it is easy to create elaborate forms with a few keystrokes In most cases, it is easier to design a Form using the IDE than it is to write by hand all the code a Form requires Forms often contain multiple Button objects; a Form can contain as many Buttons as you need