Copyright © 2012 Pearson Education, Inc. Chapter 11 MORE WINDOWS CONTROLS & STANDARD DIALOG BOXES.

Slides:



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

Chapter 7: Sub and Function Procedures
Dialog Boxes and Menus. Menus Menu Bar Contains menus which drop down to display list of menu items Each item has a name and text property Each item has.
Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
C# - Files and Streams Outline Files and Streams Classes File and Directory Creating a Sequential-Access File Reading Data from a Sequential-Access.
Chapter 11 Data Files Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
© by Pearson Education, Inc. All Rights Reserved. continued …
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18 Indexing Structures for Files.
Dialog Boxes. Slide 2 The OpenFileDialog and SaveFileDialog Controls All dialog boxes derive from the CommonDialog class and share similar features The.
1 Prototyping for HCI Spring 2004 (Week 7) Jorge A. Toro.
C# Programming: From Problem Analysis to Program Design1 Programming Based on Events C# Programming: From Problem Analysis to Program Design 3 rd Edition.
Using Multiple Forms. Creating a New Form ProjectAdd Windows Form.
Copyright © 2012 Pearson Education, Inc. Chapter 2 Introduction to Visual C#
Creating Sequential-Access File  Serializable attribute indicates to the compiler that objects of a class can be serialized– written to or read from a.
Creating web service (and client application) with Visual Studio 2008 Create web service project New project->web->ASP.NET web service application (with.
Sequential-access file Create, read and write an object into a sequential-access file Serialize and deserialize the object to write and read from a data.
C# Programming: From Problem Analysis to Program Design1 Working with Files C# Programming: From Problem Analysis to Program Design 3 rd Edition 13.
1 Windows Printing. 2 Objectives You will be able to Output text and graphics to a printer. Print multipage documents. Use the standard Windows print.
Visual C Sharp – File I/O - 1 Variables and arrays only temporary - lost when a program terminates Files used for long term storage (Data bases considered.
Chapter 12 Working with Files CIS 3260 Introduction to Programming using C# Hiro Takeda.
Dr Dat Tran - Week 4 Lecture Notes 1 MenuStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &
File Handling. Data Files Programs that can only get data from the user interface are limited. –data must be entered each time. –only small amounts of.
5-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Typing Application Introducing Keyboard Events, Menus, Dialogs and the Dictionary.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
1 Working with Menus and Dialog Boxes. 2 Objectives You will be able to Create and edit menus for Windows Forms applications. Write code to handle menu.
Dr Dat Tran - Week 4 Lecture Notes 1 ToolStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
1 / 9 Printing the Return Within TaxWise Online © 2006, Universal Tax Systems, Inc. All Rights Reserved. Printing the Return Within TaxWise Online Objectives.
11-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
BIL528 – Bilgisayar Programlama II Introduction 1.
Lecture Set 12 Sequential Files and Structures Part A – Dialog Boxes, Filters, Directories.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 9- 1.
1 Chapter Nine Using GUI Objects and the Visual Studio IDE.
Lecture 7 Dialog Controls MDI Parent/Child Interaction.
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.
1 Chapter 20 – Data sources and datasets Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Common Dialogs.  What is a Common Dialog/Why use them?  Open Dialog  Save File As Dialog  Color Dialog  Font Dialog  Print Dialog.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
Copyright © 2012 Pearson Education, Inc. Chapter 5 Loops, File, and Random Numbers.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
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.
Chapter 5 Menus, Sub Procedures and Sub Functions Programming In Visual Basic.NET.
Error Trapping Exception Catching 1. Syntax & Compile-time  VB – Editor/Compiler Logic and Design  You Runtime  You Types of Errors: 2 When your program.
Data-information stored in files on the disks and CDs in your computer system Why should we save a file when we create it on the computer?
McGraw-Hill © 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 11 Data Files.
1 /25 Working with Return Templates with TaxWise Online © 2006, Universal Tax Systems, Inc. All Rights Reserved. TaxWise Online Return Templates Objectives.
Chapter 6. Copyright 2003, Paradigm Publishing Inc. CHAPTER 6 BACKNEXTEND 6-2 LINKS TO OBJECTIVES Create Folders Select Delete Copy a Document Move a.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
DEPARTMENT MODULE User’s Guide. Step 1. Click Files Step 2. Click Department.
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”
Module 3: Creating Windows-based Applications. Overview Creating the Main Menu Creating and Using Common Dialog Boxes Creating and Using Custom Dialog.
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.
C# Programming: From Problem Analysis to Program Design
Using Multiple Forms.
Picture Viewer.
How to Add Images Using an 'openFile' Dialog
Multi-form applications and dialogs
Gathering User Input Event Handling Create Dynamic controls
File Upload.
Module 8: Creating Windows-based Applications
Menus and Dialogs.
Lecture 5 Menu Strip Demo with Dialog Controls.
Chapter 11 Saving Data and Objects In Files
Browser Control Multiple Forms
Presentation transcript:

Copyright © 2012 Pearson Education, Inc. Chapter 11 MORE WINDOWS CONTROLS & STANDARD DIALOG BOXES

The OpenFileDialog and SaveFileDialog Controls The OpenFileDialog and SaveDialog controls allow your application to display standard Windows dialog boxes for opening and saving files Unlike Label, Button, and TextBox, they are invisible controls The OpenFileDialog control displays a standard Windows Open dialog box. The SaveDialog control displays a standard Windows Save As dialog box Copyright © 2012 Pearson Education, Inc.

Displaying an Open Box When adding an OpenFileDialog control to the form, it does not appear on the form, but in an area at the bottom of the Designer called the component tray In code, you can display an Open Dialog box by calling the ShowDialog method private void button1_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); } Copyright © 2012 Pearson Education, Inc.

Detecting the User’s Selection The showDialog method returns a value that indicates which button the user clicks to dismiss the dialog box –If the user clicked the Open button, the value DialogResult.OK is returned –If the user clicked the Cancel button, the value DialogResult.Cancel is returned –The following is an example that calls the ShowDialog method to determine the user’s choice: if (openFile.ShowDialog() == DialogResult.OK) { } else if (openFile.ShowDialog() == DialogResult.Cancel) { } else { } Copyright © 2012 Pearson Education, Inc.

The Filename and InitialDirectory Property When the user selects a file with the Open dialog box, the file’s path and filename are stored in the control’s Filename property The following is an example of how to open the selected file: if (openFile.ShowDialog() == DialogResult.OK) { inputFile = File.OpenText(openFile.Filename); } else { } You can specify a directory to be initially displayed with the InitialDirectory property. For example, openFile.InitialDirectory = “C:\Data”; Copyright © 2012 Pearson Education, Inc.

Displaying a Save As Dialog Box Use the following to call the SaveFileDialog control’s ShowDialog method saveFile.ShowDialog(); Use the following to detect the user’s choice if (saveFile.ShowDialog() == DialogResult.OK) { } Use the following to open the selected file if (saveFile.ShowDialog() == DialogResult.OK) { outputFile = File.CreateText(openFile.Filename); } Copyright © 2012 Pearson Education, Inc.

Questions?