Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,

Slides:



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

Using Macros and Visual Basic for Applications (VBA) with Excel
© by Pearson Education, Inc. All Rights Reserved.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
Excel and VBA Creating an Excel Application
 2006 Pearson Education, Inc. All rights reserved Introduction to the Visual C# 2005 Express Edition IDE.
C# Programming: From Problem Analysis to Program Design1 Programming Based on Events C# Programming: From Problem Analysis to Program Design 3 rd Edition.
Compunet Corporation Programming with Visual Studio.NET GUI Week 13 Tariq Aziz and Kevin Jones.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 7- 1.
Outline Review Visual Basic.NET Environment Review Visual Basic.NET Environment First Visual Basic Planning and Programming First Visual Basic Planning.
1 Introduction to the Visual Studio.NET IDE Powerpoint slides modified from Deitel & Deitel.
Creating Menu. Objectives Create a menu system for a form –Create a menu –Create a menu titles –Create a menu items –Create a submenu –Modify menu –Edit.
BİL528 – Bilgisayar Programlama II Advanced Controls, Menus, Toolbars, and Status Bars 1.
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Multiple Forms, Standard Modules, And Menus
1- Date TimePicker 2- Month Calendar 3- User Defined Controls.
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
Chapter 12: Using Controls. Examining the IDE’s Automatically Generated Code A new Windows Forms project has been started and given the name FormWithALabelAndAButton.
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.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Assignment #1 Advanced Computer Programming.
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.
Chapter 3 – Fundamentals of Programming in VB.NET VB.NET Controls VB.NET Events Numbers Strings Input and Output.
 2009 Pearson Education, Inc. All rights reserved Introduction to the Visual Basic Express 2008 IDE.
Introduction to Visual Basic.NET Chapter 2 Introduction to Controls, Events.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 – Graphical User Interfaces Part 2 Outline.
Graphical User Interface Concepts - Part 2 Session 09 Mata kuliah: M0874 – Programming II Tahun: 2010.
Chapter 5 Menus, Common Dialog Boxes, Sub Procedures, and Function Procedures Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Introduction to Visual Basic.NET Your First Visual Basic.NET Application.
VB.NET Additional Topics
Controls. Adding Controls to Form -You can pick controls from the toolbox. -To add the controls from Toolbox to the Form You have be in design view. -To.
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.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Chapter 3 - VB.NET by Schneider1 Chapter 3 – Fundamentals of Programming in VB.NET Part I VB.NET Controls VB.NET Events.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
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.
Compunet Corporation Programming with Visual Basic.NET Working with Menus and Dialog Boxes Week 14 Tariq Aziz and Kevin Jones.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
CIS 338: Events Dr. Ralph D. Westfall April, 2011.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Chapter 2 - VB 2008 by Schneider1 Chapter 2 –Visual Basic, Controls, and Events 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual.
 2007 Pearson Education, Inc. All rights reserved Introduction to the Visual Basic Express 2005 IDE.
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.
COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
ALMAJMA'AH UNIVERSITY College of Science and Humanitarians Studies in Alghat Information Technology Section (211Tal course) 1.
Dive Into® Visual Basic 2010 Express
Graphical User Interface
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Windows Forms GUI: A Deeper Look
Simple Windows Applications
Chapter 13 Additional Topics in Visual Basic
Group Boxes, Radio buttons and Checked List Boxes
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
GUI Programming in Visual Studio .NET
Presentation transcript:

Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 2

Drag and drop MenuStrip in your form or double click on MenuStrip 3

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 1. Click here 2. Type the name of the menu you want then press Enter 3. It will look like this 4. If you run the program it will look like this 4

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Look like this in the program 5

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 4. Your menu will then look like this: To create items in File menu that we created in slide#4, 1.Click inside the Type Here box. 2. Enter the name of the item you want for example “New” 3. Press the enter key 6

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 7

 You can disable any of the items of the menu items by changing the property “Enabled” to False  By changing the property Enabled to False, this prevents the user from clicking the menuItem “Save As” as in the example below: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais So the menuItem “Save As” appears as follows 8

 You can show a tool tip text for your menu item to explain its job.  In the following example, the menuItem “Save As” we set the ToolTipText property to the following text: “This item saves your file” © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais So the menuItem “Save As” appears as follows 9

 You can hide or show your menu item using the menuItem property “Visible”  In the following example, the menuItem “Save As” we set the Visible property to false. When we run the program the “Save As” menuItem is hidden: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais So the menuItem “Save As” appears as follows 10

 Shortcut Keys ◦ All menu items can have Alt key shortcuts (also called access shortcuts or hotkeys), ◦ They are accessed by pressing Alt and the underlined letter (for example, Alt F expands the File menu). © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 11

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 1. Click on the menu you want to add shortcut key for (click on File) 2. Go to the ShortcutKeys property in the Property Window of the File MenuItem 3. Open the dropdown list and select the keys you want for example: Select Alt From the drop down list of Keys, choose the letter F 12

 When you Run the program you can open the file menu by pressing Alt + F © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 13

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 1. Click on the New menu Item 2. Set the shortcut key property Ex: Alt+A 3. The shortcutKey is displayed. 4. When you Run you program, you can open the New menu by clicking Alt+A 14

 You can hide the shortcut keys by setting property ShowShortcutKeys to False  You can modify how the control keys are displayed in the menu item by modifying property ShortcutKeyDisplayString. © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais The shortcutkey string that appears in front of the menuItem The shortcutkey property Control the appearance of the shortcutkey 15

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 16

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 17

 You can link an event to a menu item so that when a user click on the name of the menu item an event happens.  Steps to add an event to existing menu item is as follows: 1.In the design view, double click on the menuItem you want to add the event to, for example New menuitem: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 1 18

2. This will direct you to the code view with an event that is linked to the New menu item as follows: 3. Write any code you want inside the body of the New menuItem sub procedure as follows: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click End Sub Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click Label1.Text = "Hello World" Label1.BackColor = Color.Yellow MessageBox.Show("Hello World :)") End Sub 19

4. Now when we run the program it look like this. © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais After we click on the New menuItem the label will be changed 20

 In vb.net we have two controls to retrieve date and time information MonthCalendar and DateTimePicker. A.The MonthCalendar control displays a monthly calendar. B.The DateTimePicker control is similar to the MonthCalendar control, but displays the calendar when the user clicks the control’s down arrow. © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 21

 A range of dates can be selected by clicking one date on the calendar, then holding the Shift key while clicking another date. © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 22

1. (Adding MonthCalender) Drag and drop MonthCalendar control from the toolbox menu as follows: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais23

2. (Modifying MonthCalendar Properties) by clicking on the monthCalendar on the design view all of its properties will be shown in the properties window as follows: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais24

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais A. MonthCalendar Control 25

3. (Adding event to MonthCalendar) The default event for this control is DateChanged, which occurs when a new date is selected. 4. (Adding event to MonthCalendar) To add DateChanged to the month calendar, double click on the monthCalendar in the design view: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged End Sub 1.Double click on the MonthCalendar 2. This code will be displayed in the code view 26

5. (Adding event to MonthCalendar) Write the code you want inside the sub procedure event of the monthCalendar: 6. For example the following code will display the date that is selected by the user: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged MessageBox.Show("You selected the date " & MonthCalendar1.SelectionRange.Start) End Sub 27

5. (Adding event to MonthCalendar) When we run this code: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged MessageBox.Show("You selected the date " & MonthCalendar1.SelectionRange.Start) End Sub Run After clicking on a date, the following message box will appear with the selected date 28

 The DateTimePicker can be used to retrieve date and time information from the user. 1.(Adding DateTimePicker): To add a date time picker double click on it from the toolbox menu then it will appear on the form in the design view: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 29

2.(Modifying DateTimePicker properties) by clicking on the DateTimePicker on the design view, all of its properties will be shown in the properties window as follows: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 30

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 31

3.(Adding Event to the DateTimePicker Control) The default event to dateTimePicker can be added by double clicking on it in the design view. This will display the following code (The default event is ValueChanged, which occurs when a new date is selected.) : © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged End Sub 32

4.(Adding Event to the DateTimePicker Control) Add the code you want inside the event, For example: © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged MessageBox.Show("You selected the date: " & DateTimePicker1.Value.ToString()) MessageBox.Show("You selected the Time of the day: " & DateTimePicker1.Value.TimeOfDay.ToString()) End Sub 33

 When you select the date 10, April, 2012 the event occur © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 34

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Columns Items SubItems ListView 35

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 36

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 37

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 38

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 39

 In the following form (Form1) theList View with: 1.Two columns (Name – Size) 2.One Item (Document.docx) 3.One SubItem for Document.docx item (10 kb) © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 40

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 41

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Large IconDetails Small Icon List Tile 42

 The default event to the list view is SelectedIndexChanged which is triggered when the user change his selection of the item. © by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Private Sub ListView1_SelectedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged ‘ Write your Code here End Sub Double Click here 43

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Private Sub ListView1_SelectedIndexChanged (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged MessageBox.Show("You Selected an item") End Sub Double Click here Run Click on any item 44

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Nodes Child Nodes Parent Nodes 45

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 46

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 47

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais 50

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais

© by Pearson Education, Inc. All Rights Reserved. Edited By Maysoon AlDuwais Double Click here Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect MessageBox.Show("You Selected an item") End Sub Run The default event of the TreeView is AfterSelect which is triggred when the user select a node from the tree. 52