Using GUI Objects and the Visual Studio IDE

Slides:



Advertisements
Similar presentations
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Advertisements

1 Microsoft Access 2002 Tutorial 9 – Automating Tasks With Macros.
Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
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
Creating a Console Application with Visual Studio
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#
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
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.
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.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
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.
1 Chapter Nine Using GUI Objects and the Visual Studio IDE.
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.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Object-Oriented Programming: Inheritance and Polymorphism.
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
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.
1 Displaying Dialog Boxes Kashef Mughal. 2 Midterm Stats Here we go  Average was  Low was 116  High was 184  Mid Quarter Grade - check any.
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.
Dive Into® Visual Basic 2010 Express
Chapter 3: I Need a Tour Guide (Introduction to Visual Basic 2012)
Chapter 2: The Visual Studio .NET Development Environment
Chapter 1: An Introduction to Visual Basic 2015
Visual Basic Code & No.: CS 218
Chapter Topics 15.1 Graphical User Interfaces
Advanced Object-Oriented Programming Features
Chapter 8: Writing Graphical User Interfaces
Chapter 2 – Introduction to the Visual Studio .NET IDE
Multiple Classes and Inheritance
3.01 Apply Controls Associated With Visual Studio Form
Files.
Chapter Eleven Handling Events.
1. Introduction to Visual Basic
3.01 Apply Controls Associated With Visual Studio Form
Microsoft Access Illustrated
Using Procedures and Exception Handling
Social Media And Global Computing Introduction to Visual Studio
Chapter 2 – Introduction to the Visual Studio .NET IDE
Hands-on Introduction to Visual Basic .NET
Understanding the Visual IDE
CIS16 Application Development Programming with Visual Basic
Chapter 3 – Introduction to C# Programming
Object-Oriented Programming: Inheritance and Polymorphism
Chapter 15: GUI Applications & Event-Driven Programming
Visual C# - GUI and controls - 1
Tutorial 10 Automating Tasks with Macros
Presentation transcript:

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

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

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

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

Creating a MessageBox Output of MessageBox1 program

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

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

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

Adding Functionality to MessageBox Buttons Output of HamburgerAddition program

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

Creating a Form Output of CreateForm1

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

Creating a Form CreateForm2 class and Output

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

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

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

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

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

Placing a Button on a Window Output of WindowWithButton program

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

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

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

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

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

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

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

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

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

Using the Visual Studio Help Search Function Button Class documentation

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

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

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