Module 3: Creating Windows-based Applications. Overview Creating the Main Menu Creating and Using Common Dialog Boxes Creating and Using Custom Dialog.

Slides:



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

Copyright © 2012 Pearson Education, Inc. Chapter 11 MORE WINDOWS CONTROLS & STANDARD DIALOG BOXES.
C# Programming: From Problem Analysis to Program Design1 9 Programming Based on Events.
Chapter 1: An Introduction to Visual Basic.NET Programming with Microsoft Visual Basic.NET, Second Edition.
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.
Programming Based on Events
DT265-2 Object Oriented Software Development 2 Lecture 3 : Windows Programming Lecturer Pat Browne
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
WORKING WITH MACROS CHAPTER 10 WORKING WITH MACROS.
1 After completing this lesson, you will be able to: View and open folders. Open, edit, and save files. Print files. Sort files. (continued)
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Dr Dat Tran - Week 4 Lecture Notes 1 MenuStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
1 1 Lab1 Ismail M. Romi – IT Dept, PPU, Visual Basic 2005 Programming Tour.
*** CONFIDENTIAL *** © Toshiba Corporation 2008 Confidential Scheduling Reports.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
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.
A First Look At Microsoft Visual Basic Lesson 1. What is Microsoft Visual Basic? Microsoft Visual Basic is a software development tool, which means it.
Dr Dat Tran - Week 4 Lecture Notes 1 ToolStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Course ILT Access basics Unit objectives Define database and database-related terminology, and plan a database Start Access and open, create, view, and.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
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.
MS-Word XP Lesson 9. Mail Merge The Mail Merge feature combines a list of data, typically name and address that is contained in one file with a document.
BIL528 – Bilgisayar Programlama II Introduction 1.
Visual Basic.NET BASICS Lesson 1 A First Look at Microsoft Visual Basic.NET.
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.
Click your mouse to continue. The Office Shortcut Bar The Office Shortcut Bar contains program buttons that, when clicked, start new documents or start.
Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1.
Module 4: Creating a Web Application with Web Forms
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Graphical User Interface Components Version 1.1. Obectives Students should understand how to use these basic Form components to create a Graphical User.
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?
TOOLBOX. The Toolbox Intrinsic Controls - always included in the Toolbox ActiveX Controls - separate files with ocx file extension Insertable Objects.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
2-1 Chapter 2 Using VB.NET to Create a First Solution.
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 1: An Introduction to Visual Basic .NET
Chapter 9 Programming Based on Events
© 2016, Mike Murach & Associates, Inc.
Customizing the Quick Access Toolbar in Microsoft Office
Chapter 1: An Introduction to Visual Basic 2015
Chapter 2 – Introduction to the Visual Studio .NET IDE
GUI Programming using Windows Form
Using Multiple Forms.
Chapter 1: An Introduction to Visual Basic 2015
Using Procedures and Exception Handling
Lesson 8: Granting Patient List [Proxy] Access
How to Add Images Using an 'openFile' Dialog
Multi-form applications and dialogs
Programming Based on Events
Module 13: Creating Data Visualizations with Power View
Lesson Seven: Maintaining Patient Lists
Lesson 8: Granting Patient List [Proxy] Access
Development The Foundation Window.
Lecture Set 10 Windows Controls and Forms
Module 8: Creating Windows-based Applications
Based on Murach Chapter 10
Visual C# - GUI and controls - 1
Chapter 13 Additional Topics in Visual Basic
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

Module 3: Creating Windows-based Applications

Overview Creating the Main Menu Creating and Using Common Dialog Boxes Creating and Using Custom Dialog Boxes Creating and Using Toolbars Creating the Status Bar Creating and Using Combo Boxes

Lesson: Creating the Main Menu How to Create the Main Menu How to Associate Methods with Menu Items

Demonstration: Creating the Main Menu This instructor-led demonstration will show you how to add a MainMenu control to a Windows Form in C#. It will also show how to create a hierarchy of menus and write code for the Click event.

How to Create the Main Menu

How to Associate Methods with Menu Items Double-click the menu item to open the event handler Write code for the event handler this.menuItemFilePrint.Index = 4; this.menuItemFilePrint.Text = "Print..."; this.menuItemFilePrint.Click += new System.EventHandler(this.menuItemFilePrint_Click); public void menuItemFilePrint_Click( Object sender, EventArgs e ) { // code that runs when the event occurs } this.menuItemFilePrint.Index = 4; this.menuItemFilePrint.Text = "Print..."; this.menuItemFilePrint.Click += new System.EventHandler(this.menuItemFilePrint_Click); public void menuItemFilePrint_Click( Object sender, EventArgs e ) { // code that runs when the event occurs }

Practice: Creating the Main Menu You will practice creating the main menu, adding items such as File, View, and Exit to the menu. You will create an event handler for one of the menu options, such as Exit. You can use the solution to this practice in the next lesson You will practice creating the main menu, adding items such as File, View, and Exit to the menu. You will create an event handler for one of the menu options, such as Exit. You can use the solution to this practice in the next lesson Guided Practice 10 min

Lesson: Creating and Using Common Dialog Boxes How to Create and Use a Common Dialog Box How to Set Common Dialog Box Properties How to Read Information from a Common Dialog Box

Demonstration: Creating and Using a Common Dialog Box This instructor-led demonstration will show you how to create a common dialog box, for example OpenFileDialog, and add functionality to it

How to Create and Use a Common Dialog Box To create a dialog box in an application: Drag a common dialog box to your form Browse to the event handler with which you want to open the dialog box In the event handler, add the code to open the dialog box private void OpenMenuItem_Click(object sender, System.EventArgs e) { openFileDialog1.ShowDialog(); } private void OpenMenuItem_Click(object sender, System.EventArgs e) { openFileDialog1.ShowDialog(); }

How to Set Common Dialog Box Properties Properties window Options

How to Read Information from a Common Dialog Box Use the value returned by this property to determine what action the user has taken Use the value returned by this property to determine what action the user has taken DialogResultProperty Reading the results from a dialog box Determine the DialogResult OK, Cancel, Abort, Retry, Ignore, Yes, No, (or None) Determine the DialogResult OK, Cancel, Abort, Retry, Ignore, Yes, No, (or None) if (openFileDialog1.ShowDialog() == DialogResult.OK) { MessageBox.Show(openFileDialog1.FileName); } if (openFileDialog1.ShowDialog() == DialogResult.OK) { MessageBox.Show(openFileDialog1.FileName); }

Practice: Using a Common Dialog Box In this practice, you will add an OpenFileDialog control to an application. Optional tasks include filtering file types. Optional: use your solution from the previous lesson In this practice, you will add an OpenFileDialog control to an application. Optional tasks include filtering file types. Optional: use your solution from the previous lesson Guided Practice 10 min

Lesson: Creating and Using Custom Dialog Boxes How to Create and Use a Custom Dialog Box How to Create and Use a Custom Tabbed Dialog Box

Demonstration: Creating and Using a Custom Dialog Box This instructor-led demonstration will show you how to create a custom dialog box, dismiss the dialog box by adding OK and Cancel buttons, set the DialogResult properties, and add an event method to display the dialog box

How to Create and Use a Custom Dialog Box Set dialog box properties Use the Toolbox to add a dialog box to the form Add event methods to display the dialog box Display the dialog using Show () or DoModal()

Demonstration: Creating a Custom Tabbed Dialog Box This instructor-led demonstration will show you how to add and remove a tab to a custom dialog box in the designer

How to Create and Use a Custom Tabbed Dialog Box Tabs

Practice: Creating a Custom Dialog Box In this practice, you will create a custom dialog box that can be used to set an application option that allows the animal name label to be optionally displayed Optional: use your solution from the previous lesson In this practice, you will create a custom dialog box that can be used to set an application option that allows the animal name label to be optionally displayed Optional: use your solution from the previous lesson Guided Practice 10 min

Lesson: Creating and Using Toolbars How to Create a Toolbar How to Use Toolbar Properties How to Write Code for the ButtonClick Event

Demonstration: Creating a Toolbar This instructor-led demonstration will show you how to create a toolbar, set the toolbar properties, add icons to a toolbar and set the docking options of a toolbar

How to Create a Toolbar

How to Use Toolbar Properties Button Docked on top Use for Icons

How to Write Code for the ButtonClick Event All buttons on a toolbar share a single Click event Use the Tag property of the button to define the action Add an event handler for the ButtonClick event of the Toolbar control Determine the button the user clicks Call the action defined in the Tag property

Practice: Creating and Using a Toolbar In this practice, you create a toolbar and add File, Open, File Save, and View Next buttons to it Optional: use your solution from the previous lesson In this practice, you create a toolbar and add File, Open, File Save, and View Next buttons to it Optional: use your solution from the previous lesson Guided Practice 10 min

Lesson: Creating the Status Bar How to Create a Status Bar How to Add Panels to a Status Bar Status Bar Panels Status Bar

Demonstration: Creating a Status Bar This instructor-led demonstration will show you how to create a status bar, set the status bar properties and add panels to the status bar

How to Create a Status Bar Add a StatusBar control from the Toolbox to the form Open the form to which you will add a status bar Set StatusBar Properties

How to Add Panels to a Status Bar Open the Properties window for the StatusBar control Set the ShowPanels property to True In the Panels property, open the StatusBarPanel Collection Editor Use the Add and Remove buttons to add and remove status bar panels Set the panel properties Close the StatusBarPanel Collection Editor

Practice: Creating the Status Bar In this practice, you will create a status bar for the application and set the status bar properties by displaying some information on it Optional: use your solution from the previous lesson In this practice, you will create a status bar for the application and set the status bar properties by displaying some information on it Optional: use your solution from the previous lesson Guided Practice 10 min

Lesson: Creating and Using Combo Boxes

Demonstration: Creating and Using a Combo Box This instructor-led demonstration will show you how to create a Combo Box, and how to associate objects with the Combo Box

How to Use a Combo Box Create the combo box Add items to the combo box Write an event handler ComboBox cb = new ComboBox() object[] cbItems = {"Lion", "Elephant", "Duck"}; ComboBox.Items.Add(cbItems); object[] cbItems = {"Lion", "Elephant", "Duck"}; ComboBox.Items.Add(cbItems); comboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { ComboBox c = (ComboBox) sender; MessageBox.Show( c.SelectedItem ); } comboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { ComboBox c = (ComboBox) sender; MessageBox.Show( c.SelectedItem ); }

Practice: Using a ComboBox Control In this practice, you will add a ComboBox control to the main form. The purpose of the combo box is to allow you to select animals from the menu, rather than by clicking the “Next” button. Optional: use your solution from the previous lesson In this practice, you will add a ComboBox control to the main form. The purpose of the combo box is to allow you to select animals from the menu, rather than by clicking the “Next” button. Optional: use your solution from the previous lesson Guided Practice 10 min

Review Creating the Main Menu Creating and Using Common Dialog Boxes Creating and Using Custom Dialog Boxes Creating and Using Toolbars Creating the Status Bar Creating and Using Combo Boxes

Lab 8.1: Building Windows Applications Exercise 1: Adding common dialog boxes to an application Exercise 2: Creating and using custom dialog boxes Exercise 3: Creating a status bar Exercise 4 (if time permits): Using ComboBox controls 1 hour