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.

Slides:



Advertisements
Similar presentations
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
Advertisements

© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 7: Chapter 4: Slide 1 Unit 7 Decisions (Cont.) and Message Boxes Chapter.
Copyright © 2012 Pearson Education, Inc. Chapter 11 MORE WINDOWS CONTROLS & STANDARD DIALOG BOXES.
CVEV 118/698 Visual Basic Lecture 3 Prof. Mounir Mabsout Elsa Sulukdjian Walid El Asmar.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Access Tutorial 10 Automating Tasks with Macros
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
WORKING WITH MACROS CHAPTER 10 WORKING WITH MACROS.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
V 1.0 Programming III. Creation of additional windows Routed events.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Six Repeating Program Instructions.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
Microsoft Expression Web-Illustrated Unit I: Working with Tables.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Writing a JavaScript User-Defined Function  A function is JavaScript code written to perform certain tasks repeatedly  Built-in functions.
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 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
BIM211 – Visual Programming Interacting with Users Graphics 1.
1 Chapter Nine Using GUI Objects and the Visual Studio IDE.
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.
Common Dialogs.  What is a Common Dialog/Why use them?  Open Dialog  Save File As Dialog  Color Dialog  Font Dialog  Print Dialog.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Creating a Multiple-Form Interface.
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.
Graphical User Interface Components Version 1.1. Obectives Students should understand how to use these basic Form components to create a Graphical User.
XP New Perspectives on Creating Web Pages With Word Tutorial 1 1 Creating Web Pages With Word Tutorial 1.
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.
Module 3: Creating Windows-based Applications. Overview Creating the Main Menu Creating and Using Common Dialog Boxes Creating and Using Custom Dialog.
CIS 338: Dialog Boxes Dr. Ralph D. Westfall April, 2011.
Lesson 13 PROTECTING AND SHARING DOCUMENTS
Chapter 3: I Need a Tour Guide (Introduction to Visual Basic 2012)
Multiple Forms and Menus
Chapter 1: An Introduction to Visual Basic .NET
Excel Tutorial 8 Developing an Excel Application
Topics Graphical User Interfaces Using the tkinter Module
Practical Office 2007 Chapter 10
Chapter 1: An Introduction to Visual Basic 2015
Apply Procedures to Develop Message, Input, and Dialog Boxes
GUI Programming using Windows Form
3.01 Apply Controls Associated With Visual Studio Form
Files.
Using GUI Objects and the Visual Studio IDE
Lesson 13 PROTECTING AND SHARING DOCUMENTS
Using Procedures and Exception Handling
Repeating Program Instructions
Introduction to Patient Lists
Message, Input, Confirm, and Specialized Dialogs
Predefined Dialog Boxes
Module 1: Getting Started with Windows 95
Microsoft Office Access 2003
Multi-form applications and dialogs
Creating and Modifying Queries
Microsoft Office Access 2003
Microsoft Visual Basic 2005: Reloaded Second Edition
WEB PROGRAMMING JavaScript.
COMMON CONTROLS A control is a child window that an application uses in conjunction with another window to enable user interaction. Controls are most often.
Copyright © 2006 Thomas P. Skinner
Control Structures Part B - Message and Input Boxes
Multi-Form Applications Things You Need to Know
Module 8: Creating Windows-based Applications
Part 3 Saving (without the Save button)
Prepare a DD Form 1081-Return
Lesson Seven: Customizing Columns in Patient Lists
Common Dialog Boxes.
Creating Additional Input Items
– A principal I/O mechanism in Windows
Wings 2.0 Business Flow Reference
Presentation transcript:

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. MessageBox objects 5. Controls on Forms (already discussed) First three are essentially constructed in the same way Differ in how you bring them up

Main Window Created when you create a Windows Form Project Associated with application object in Main() when called as an argument to the Run() function, e.g.,: Application.Run(new MainWindow()); When it is closed, all other child windows in the application are closed

Child Windows Created within an application, but don’t demand attention Created in two steps: construct & show, e.g., WindowDemo wnd=new WindowDemo(); wnd.Show(); Multiple child windows can be open inside application Some care required to ensure they keep each other updated MDI (multi-document interface) applications have some code built in

Dialog Boxes Created within an application and lock application until dismissed Created in two steps: construct & show, e.g., WindowDemo wnd=new WindowDemo(); wnd.ShowDialog(); Buttons in a dialog may return DialogResult enum values Close dialog when pressed Button value is returned by ShowDialog()

Example Dialog Code Comments: MultipleChoice is a form that holds a multiple choice test (q is the question) that is presented in dialog form If user presses the button associated with DialogResult.OK (the “Submit” button on the form, we score the question If the user exits some other way (e.g., cancelling) we return false. Other results that can be attached to buttons include: Abort, Cancel, Retry, Ignore, OK, No, None, Yes.

DialogResult Property Comments: OK property is attached to Submit button Cancel property is attached to Cancel button (not shown)

Designing Dialog Boxes Ensure properties are defined so your code can access information in the box, e.g., if (dlg.Correct) Score = Score+PointsPerQuestion; Work with temporary variables in your form, so user can cancel if necessary Provide buttons (with DialogResult values) so user doesn’t have to cancel the window Remember that the choice to display a child window or dialog is just a matter of what show function you use--Show() or ShowDialog()

Standard Dialog Boxes Comments: Pre-created dialogs to save the user the need to design dialogs for frequently required tasks Adding them to a form Dragging them on to a form creates member variable and initialization code Dialog can then be launched without new step Can also be created and used just like user- developed dialog, without being placed on the form

Message Boxes A simple class designed to send a message to a user or prompt for a simple result (e.g., Yes, No) Invoked with a static function in the MessageBox class, i.e., MessageBox.Show(“This is a message”); There are many overloads. The MessageBoxButtons enumeration defines combinations of buttons that can be displayed The return value of the Show() function holds the result

Example Comments: Prompt is “Click a button” Title bar is “Message box test” Yes, No and Cancel buttons specified (MessageBoxButtons.YesNoCancel)

Parting words… Dialog boxes are convenient means of getting information from the user If it’s just a simple (e.g., yes/no) question, create a message box A number of predefined standard dialog boxes, that we’ll be using in Modules 3 & 4, exist File dialog Color dialog Font dialog