SlideShare a Scribd company logo
1 of 25
GUI Applications Development Using .NET Framework
Objectives


                In this session, you will learn to:
                   Validate user input using controls and events
                   Work with the CommonDialog class
                   Create a custom dialog box




     Ver. 1.0                        Session 4                     Slide 1 of 25
GUI Applications Development Using .NET Framework
Validation of User Inputs


                Validation is a means to check the accuracy and
                correctness of the data entered by a user in an application.
                By performing validation, you can prompt the user to enter
                correct data and therefore, reduce errors.
                To validate data in a control, the Validating event of that
                control can be used.
                After performing validation, the user can be prompted by an
                appropriate message.
                This message can be displayed using:
                   MessageBox class
                   ErrorProvider Control
                   StatusStrip Control
                Let us understand how the data in the controls can be
                validated.

     Ver. 1.0                       Session 4                        Slide 2 of 25
GUI Applications Development Using .NET Framework
Just a minute


                Name the event that enables the user to prevent shifting of
                focus from a control until all the validation rules have been
                met.




                Answer:
                   The Validating event


     Ver. 1.0                       Session 4                          Slide 3 of 25
GUI Applications Development Using .NET Framework
The MessageBox Class


               • The MessageBox class is used to display informative
                 messages to users.
               • For example, the following code snippet displays a
                 message box on the click event of a button.
                  private void button1_Click(object
                 sender,EventArgs e)
                      {
                  MessageBox.Show("The entered data is not
                  valid. Please enter valid data.", "Data
                  Entry Error", MessageBoxButtons.OK,
                 MessageBoxIcon.Error);
                      }
                                                           Message Box Text



    Ver. 1.0                       Session 4                       Slide 4 of 25
GUI Applications Development Using .NET Framework
The MessageBox Class (Contd.)


                • The MessageBox class is used to display informative
                  messages to users.
                • For example, the following code snippet displays a
                  message box on the click event of a button.
                   private void button1_Click(object
                  sender,EventArgs e)
                       {
                   MessageBox.Show("The entered data is not
                   valid. Please enter valid data.", "Data
                   Entry Error", MessageBoxButtons.OK,
                  MessageBoxIcon.Error);                       Message Box Title
                       }



     Ver. 1.0                          Session 4                          Slide 5 of 25
GUI Applications Development Using .NET Framework
The MessageBox Class (Contd.)


                • The MessageBox class is used to display informative
                  messages to users.
                • For example, the following code snippet displays a
                  message box on the click event of a button.
                   private void button1_Click(object
                  sender,EventArgs e)
                       {
                   MessageBox.Show("The entered data is not
                   valid. Please enter valid data.", "Data
                   Entry Error", MessageBoxButtons.OK,
                  MessageBoxIcon.Error);
                       }

                                                            Message Box Button

     Ver. 1.0                       Session 4                       Slide 6 of 25
GUI Applications Development Using .NET Framework
The MessageBox Class (Contd.)


                • The MessageBox class is used to display informative
                  messages to users.
                • For example, the following code snippet displays a
                  message box on the click event of a button.
                   private void button1_Click(object
                  sender,EventArgs e)
                       {
                   MessageBox.Show("The entered data is not
                   valid. Please enter valid data.", "Data
                   Entry Error", MessageBoxButtons.OK,
                  MessageBoxIcon.Error);
                       }
                                                        Message Box Icon




     Ver. 1.0                       Session 4                        Slide 7 of 25
GUI Applications Development Using .NET Framework
Just a minute


                • How many parameters are there in the Show() method of
                  the MessageBox class?
                   1. One
                   2. Two
                   3. Three
                   4. Four




                  Answer:
                   4. Four


     Ver. 1.0                       Session 4                     Slide 8 of 25
GUI Applications Development Using .NET Framework
Just a minute


                • Which method of the MessageBox class is used to display
                  a message in the message box?




                  Answer:
                   – The Show() method


     Ver. 1.0                        Session 4                     Slide 9 of 25
GUI Applications Development Using .NET Framework
The StatusStrip Control


                • The StatusStrip control is a container control derived from
                  System.Windows.Forms.ToolStrip class.
                • This control is used to:
                    – Display information about the objects that are on the current
                      form.
                    – Provide feedback on the progress of any operation being
                      performed by the form.
                   A StatusStrip control contains four child controls. These
                   child controls are:
                      StatusLabel
                      ProgressBar
                      DropDownButton
                      SplitButton



     Ver. 1.0                           Session 4                            Slide 10 of 25
GUI Applications Development Using .NET Framework
The StatusStrip Control (Contd.)


                The following figure shows the StatusStrip control with its
                child controls.




                                                    This control is used to
                                                    display status information
                                                   This control is used to show
                                                    and prompt the user for a
                                                     This control displays
                                                   the completion status of any
                                                    valid entry.
                                                ThisToolStripDropDown from
                                                      control is a
                                                   task.
                                                combination user standard a
                                                     which a of a can select
                                                button on the left andmany
                                                     single item from a
                                                     items.
                                                dropdown button on the
                                                right.



     Ver. 1.0                       Session 4                               Slide 11 of 25
GUI Applications Development Using .NET Framework
Just a minute


                Which of the following position is the default docking
                position of the StatusStrip control on the form?
                 1.   Left
                 2.   Right
                 3.   Top
                 4.   Bottom




                Answer:
                 4. Bottom


     Ver. 1.0                       Session 4                            Slide 12 of 25
GUI Applications Development Using .NET Framework
Just a minute


                Which property of the ProgressBar control specifies the
                amount to increment the current value of the control?
                 1.   Minimum
                 2.   Maximum
                 3.   Value
                 4.   Step




                Answer:
                 4. Step


     Ver. 1.0                      Session 4                        Slide 13 of 25
GUI Applications Development Using .NET Framework
The ErrorProvider Control


                The ErrorProvider control can be used to display an error
                message, whenever the user positions the mouse pointer
                over the error icon.
                This error icon is displayed next to the control in which the
                user has entered invalid data.
                The following figure displays an ErrorProvider control
                attached to a text box on the form.


                                                           ErrorProvider
                                                           Control




     Ver. 1.0                       Session 4                              Slide 14 of 25
GUI Applications Development Using .NET Framework
Just a minute


                Which property of the ErrorProvider control automatically
                sets to the form to which it is added?
                 1.   SetError
                 2.   ContainerControl
                 3.   Error on errorProviderControlName
                 4.   BlinkStyle




                Answer:
                 2. ContainerControl


     Ver. 1.0                          Session 4                    Slide 15 of 25
GUI Applications Development Using .NET Framework
Demo: Validating Data


                Problem Statement:
                   SigmaCom is a telecommunication company which is
                   developing software that would gather information about its
                   employees. The company requires that the information entered
                   should be correct and all the fields should be filled with
                   required data and that no fields are left blank.
                   Help the company to develop the required application.




     Ver. 1.0                       Session 4                          Slide 16 of 25
GUI Applications Development Using .NET Framework
Demo: Validating Data (Contd.)


                Solution:
                   To meet the preceding requirement, you need to perform the
                   following tasks:
                     1.   Create a new VC# application.
                     2.   Design the Employee Information form.
                     3.   Add code to perform the desired tasks.
                     4.   Execute the application and verify the output.




     Ver. 1.0                            Session 4                         Slide 17 of 25
GUI Applications Development Using .NET Framework
Introducing CommonDialog Classes


                • In VC#, the CommonDialog class is the base class for
                  displaying common dialog boxes such as font dialog box,
                  open dialog box, and save dialog box.




     Ver. 1.0                        Session 4                      Slide 18 of 25
GUI Applications Development Using .NET Framework
Types of CommonDialog Classes


                • There are various classes that are inherited from the
                  CommonDialog class. These are:
                      ColorDialog class
                      FontDialog class
                      FileDialog class
                      OpenFileDialog class
                      SaveFileDialog class
                      FolderBrowserDialog class
                      PrintDialog class
                   Let us understand how these dialog boxes work.




     Ver. 1.0                         Session 4                           Slide 19 of 25
GUI Applications Development Using .NET Framework
Creating Custom Dialog Box


                In VC#, the user can create customized dialog boxes in
                order to perform some specific tasks.
                The Windows Forms Designer can be used for creating a
                custom dialog box with the following changes:
                – Assign a value of FixedDialog to the FormBorderStyle
                  property of the form.
                – Assign a value of False to the ControlBox, MinimizeBox,
                  and MaximizeBox properties of the form.
                – Assign an appropriate value to the DialogResult property
                  for each button used on the form.




     Ver. 1.0                      Session 4                        Slide 20 of 25
GUI Applications Development Using .NET Framework
Just a minute


                All the classes that inherit from the CommonDialog class
                override the ___________ method to create a specific
                dialog box.




                Answer:
                   RunDialog()


     Ver. 1.0                      Session 4                        Slide 21 of 25
GUI Applications Development Using .NET Framework
Demo: Creating Custom Dialog Box


                Problem Statement:
                   Create an application that would accept the user input into a
                   rich text box control. The application should have a Zoom
                   button. This button should invoke a custom dialog box, which
                   should accept a numeric value from a user. Whatever value is
                   passed through the dialog box, the text in the rich text box
                   control should get enlarged by that percentage.




     Ver. 1.0                       Session 4                            Slide 22 of 25
GUI Applications Development Using .NET Framework
Demo: Creating Custom Dialog Box (Contd.)


                Solution:
                   To create the application, you need to perform the following
                   tasks:
                     1.   Create a new VC# application.
                     2.   Design the main form.
                     3.   Design a custom dialog box.
                     4.   Add code in the custom dialog box.
                     5.   Add code in the main form.
                     6.   Execute the application and verify the output.




     Ver. 1.0                            Session 4                         Slide 23 of 25
GUI Applications Development Using .NET Framework
Summary


               In this session, you learned that:
                – Validation is a means to check the accuracy and the
                  correctness of the data entered by the user.
                – The Validating event enables you to prevent the user from
                  shifting the focus from the control being validated to some
                  other control on the form until all validation rules have been
                  met.
                – The MessageBox class is used to display prompts and
                  messages on the screen. After closing the message box the
                  user cannot see the message.
                – An instance of the MessageBox class cannot be created by
                  using the new keyword.
                – The StatusStrip control is derived from
                  System.Windows.Forms.ToolStrip class. It is a container
                  control that can hold other controls.


    Ver. 1.0                        Session 4                          Slide 24 of 25
GUI Applications Development Using .NET Framework
Summary (Contd.)


                 The StatusStrip control contains four types of controls. The
                 controls are:
                   •   StatusLabel
                   •   ProgressBar
                   •   DropDownButton
                   •   SplitButton
               – The ErrorProvider control is used to display an error message,
                 whenever the user positions the mouse pointer over the error
                 icon.
               – The CommonDialog class is the base class for the most
                 commonly used dialog boxes, such as, Color, Font, File,
                 FolderBrowser, Print, and Page Setup.
               – A Custom dialog box can be created by setting some
                 properties of the Windows Form such as, FormBorderStyle,
                 ControlBox, MinimizeBox, and MaximizeBox.


    Ver. 1.0                       Session 4                            Slide 25 of 25

More Related Content

Viewers also liked

10 ds and algorithm session_14
10 ds and algorithm session_1410 ds and algorithm session_14
10 ds and algorithm session_14Niit Care
 
C programming session 02
C programming session 02C programming session 02
C programming session 02AjayBahoriya
 
12 ds and algorithm session_17
12 ds and algorithm session_1712 ds and algorithm session_17
12 ds and algorithm session_17Niit Care
 
Algorithm 110801105245-phpapp01-120223065724-phpapp02
Algorithm 110801105245-phpapp01-120223065724-phpapp02Algorithm 110801105245-phpapp01-120223065724-phpapp02
Algorithm 110801105245-phpapp01-120223065724-phpapp02dhruv patel
 
09 ds and algorithm session_13
09 ds and algorithm session_1309 ds and algorithm session_13
09 ds and algorithm session_13Niit Care
 
11 ds and algorithm session_16
11 ds and algorithm session_1611 ds and algorithm session_16
11 ds and algorithm session_16Niit Care
 
Ado.net session08
Ado.net session08Ado.net session08
Ado.net session08Niit Care
 
Ado.net session13
Ado.net session13Ado.net session13
Ado.net session13Niit Care
 
Ado.net session05
Ado.net session05Ado.net session05
Ado.net session05Niit Care
 
Ado.net session02
Ado.net session02Ado.net session02
Ado.net session02Niit Care
 
Ado.net session07
Ado.net session07Ado.net session07
Ado.net session07Niit Care
 
Ado.net session11
Ado.net session11Ado.net session11
Ado.net session11Niit Care
 
ds and algorithm session
ds and algorithm sessionds and algorithm session
ds and algorithm sessionVarun Garg
 
05 ds and algorithm session_07
05 ds and algorithm session_0705 ds and algorithm session_07
05 ds and algorithm session_07Niit Care
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08Niit Care
 
Training on java niit (sahil gupta 9068557926)
Training on java niit (sahil gupta 9068557926)Training on java niit (sahil gupta 9068557926)
Training on java niit (sahil gupta 9068557926)Sahil Gupta
 

Viewers also liked (20)

10 ds and algorithm session_14
10 ds and algorithm session_1410 ds and algorithm session_14
10 ds and algorithm session_14
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
 
12 ds and algorithm session_17
12 ds and algorithm session_1712 ds and algorithm session_17
12 ds and algorithm session_17
 
Algorithm 110801105245-phpapp01-120223065724-phpapp02
Algorithm 110801105245-phpapp01-120223065724-phpapp02Algorithm 110801105245-phpapp01-120223065724-phpapp02
Algorithm 110801105245-phpapp01-120223065724-phpapp02
 
09 ds and algorithm session_13
09 ds and algorithm session_1309 ds and algorithm session_13
09 ds and algorithm session_13
 
11 ds and algorithm session_16
11 ds and algorithm session_1611 ds and algorithm session_16
11 ds and algorithm session_16
 
Ado.net session08
Ado.net session08Ado.net session08
Ado.net session08
 
Ado.net session13
Ado.net session13Ado.net session13
Ado.net session13
 
Ado.net session05
Ado.net session05Ado.net session05
Ado.net session05
 
Ado.net session02
Ado.net session02Ado.net session02
Ado.net session02
 
Ado.net session07
Ado.net session07Ado.net session07
Ado.net session07
 
Ado.net session11
Ado.net session11Ado.net session11
Ado.net session11
 
Test Engine
Test EngineTest Engine
Test Engine
 
ds and algorithm session
ds and algorithm sessionds and algorithm session
ds and algorithm session
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Asp
AspAsp
Asp
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
05 ds and algorithm session_07
05 ds and algorithm session_0705 ds and algorithm session_07
05 ds and algorithm session_07
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08
 
Training on java niit (sahil gupta 9068557926)
Training on java niit (sahil gupta 9068557926)Training on java niit (sahil gupta 9068557926)
Training on java niit (sahil gupta 9068557926)
 

Similar to 03 gui 04

Introtodotnet
IntrotodotnetIntrotodotnet
Introtodotnetrashmix
 
IntroToDotNetTech
IntroToDotNetTechIntroToDotNetTech
IntroToDotNetTechrashmix
 
CIS/355 ilab 4 of 6
CIS/355 ilab 4 of 6CIS/355 ilab 4 of 6
CIS/355 ilab 4 of 6helpido6
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshopdhi her
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Bhushan Mulmule
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0DivyaR219113
 
The Ring programming language version 1.5.1 book - Part 67 of 180
The Ring programming language version 1.5.1 book - Part 67 of 180The Ring programming language version 1.5.1 book - Part 67 of 180
The Ring programming language version 1.5.1 book - Part 67 of 180Mahmoud Samir Fayed
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introductionbloodyedge03
 
05 intel v_tune_session_07
05 intel v_tune_session_0705 intel v_tune_session_07
05 intel v_tune_session_07Niit Care
 
engineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.pptengineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.pptsharanyak0721
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinFormHock Leng PUAH
 
06 win forms
06 win forms06 win forms
06 win formsmrjw
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)Bilal Amjad
 

Similar to 03 gui 04 (20)

Introtodotnet
IntrotodotnetIntrotodotnet
Introtodotnet
 
IntroToDotNetTech
IntroToDotNetTechIntroToDotNetTech
IntroToDotNetTech
 
07 gui 10
07 gui 1007 gui 10
07 gui 10
 
01 gui 01
01 gui 0101 gui 01
01 gui 01
 
Vista uipi.ppt (1)
Vista uipi.ppt (1)Vista uipi.ppt (1)
Vista uipi.ppt (1)
 
02 gui 02
02 gui 0202 gui 02
02 gui 02
 
CIS/355 ilab 4 of 6
CIS/355 ilab 4 of 6CIS/355 ilab 4 of 6
CIS/355 ilab 4 of 6
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshop
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
The Ring programming language version 1.5.1 book - Part 67 of 180
The Ring programming language version 1.5.1 book - Part 67 of 180The Ring programming language version 1.5.1 book - Part 67 of 180
The Ring programming language version 1.5.1 book - Part 67 of 180
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Csharp
CsharpCsharp
Csharp
 
Controls
ControlsControls
Controls
 
05 intel v_tune_session_07
05 intel v_tune_session_0705 intel v_tune_session_07
05 intel v_tune_session_07
 
engineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.pptengineeringdsgtnotesofunitfivesnists.ppt
engineeringdsgtnotesofunitfivesnists.ppt
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
 
06 win forms
06 win forms06 win forms
06 win forms
 
Graphical User Interface (Gui)
Graphical User Interface (Gui)Graphical User Interface (Gui)
Graphical User Interface (Gui)
 

More from Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 
Dacj 1-3 a
Dacj 1-3 aDacj 1-3 a
Dacj 1-3 a
 

Recently uploaded

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

03 gui 04

  • 1. GUI Applications Development Using .NET Framework Objectives In this session, you will learn to: Validate user input using controls and events Work with the CommonDialog class Create a custom dialog box Ver. 1.0 Session 4 Slide 1 of 25
  • 2. GUI Applications Development Using .NET Framework Validation of User Inputs Validation is a means to check the accuracy and correctness of the data entered by a user in an application. By performing validation, you can prompt the user to enter correct data and therefore, reduce errors. To validate data in a control, the Validating event of that control can be used. After performing validation, the user can be prompted by an appropriate message. This message can be displayed using: MessageBox class ErrorProvider Control StatusStrip Control Let us understand how the data in the controls can be validated. Ver. 1.0 Session 4 Slide 2 of 25
  • 3. GUI Applications Development Using .NET Framework Just a minute Name the event that enables the user to prevent shifting of focus from a control until all the validation rules have been met. Answer: The Validating event Ver. 1.0 Session 4 Slide 3 of 25
  • 4. GUI Applications Development Using .NET Framework The MessageBox Class • The MessageBox class is used to display informative messages to users. • For example, the following code snippet displays a message box on the click event of a button. private void button1_Click(object sender,EventArgs e) { MessageBox.Show("The entered data is not valid. Please enter valid data.", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Message Box Text Ver. 1.0 Session 4 Slide 4 of 25
  • 5. GUI Applications Development Using .NET Framework The MessageBox Class (Contd.) • The MessageBox class is used to display informative messages to users. • For example, the following code snippet displays a message box on the click event of a button. private void button1_Click(object sender,EventArgs e) { MessageBox.Show("The entered data is not valid. Please enter valid data.", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Message Box Title } Ver. 1.0 Session 4 Slide 5 of 25
  • 6. GUI Applications Development Using .NET Framework The MessageBox Class (Contd.) • The MessageBox class is used to display informative messages to users. • For example, the following code snippet displays a message box on the click event of a button. private void button1_Click(object sender,EventArgs e) { MessageBox.Show("The entered data is not valid. Please enter valid data.", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Message Box Button Ver. 1.0 Session 4 Slide 6 of 25
  • 7. GUI Applications Development Using .NET Framework The MessageBox Class (Contd.) • The MessageBox class is used to display informative messages to users. • For example, the following code snippet displays a message box on the click event of a button. private void button1_Click(object sender,EventArgs e) { MessageBox.Show("The entered data is not valid. Please enter valid data.", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Message Box Icon Ver. 1.0 Session 4 Slide 7 of 25
  • 8. GUI Applications Development Using .NET Framework Just a minute • How many parameters are there in the Show() method of the MessageBox class? 1. One 2. Two 3. Three 4. Four Answer: 4. Four Ver. 1.0 Session 4 Slide 8 of 25
  • 9. GUI Applications Development Using .NET Framework Just a minute • Which method of the MessageBox class is used to display a message in the message box? Answer: – The Show() method Ver. 1.0 Session 4 Slide 9 of 25
  • 10. GUI Applications Development Using .NET Framework The StatusStrip Control • The StatusStrip control is a container control derived from System.Windows.Forms.ToolStrip class. • This control is used to: – Display information about the objects that are on the current form. – Provide feedback on the progress of any operation being performed by the form. A StatusStrip control contains four child controls. These child controls are: StatusLabel ProgressBar DropDownButton SplitButton Ver. 1.0 Session 4 Slide 10 of 25
  • 11. GUI Applications Development Using .NET Framework The StatusStrip Control (Contd.) The following figure shows the StatusStrip control with its child controls. This control is used to display status information This control is used to show and prompt the user for a This control displays the completion status of any valid entry. ThisToolStripDropDown from control is a task. combination user standard a which a of a can select button on the left andmany single item from a items. dropdown button on the right. Ver. 1.0 Session 4 Slide 11 of 25
  • 12. GUI Applications Development Using .NET Framework Just a minute Which of the following position is the default docking position of the StatusStrip control on the form? 1. Left 2. Right 3. Top 4. Bottom Answer: 4. Bottom Ver. 1.0 Session 4 Slide 12 of 25
  • 13. GUI Applications Development Using .NET Framework Just a minute Which property of the ProgressBar control specifies the amount to increment the current value of the control? 1. Minimum 2. Maximum 3. Value 4. Step Answer: 4. Step Ver. 1.0 Session 4 Slide 13 of 25
  • 14. GUI Applications Development Using .NET Framework The ErrorProvider Control The ErrorProvider control can be used to display an error message, whenever the user positions the mouse pointer over the error icon. This error icon is displayed next to the control in which the user has entered invalid data. The following figure displays an ErrorProvider control attached to a text box on the form. ErrorProvider Control Ver. 1.0 Session 4 Slide 14 of 25
  • 15. GUI Applications Development Using .NET Framework Just a minute Which property of the ErrorProvider control automatically sets to the form to which it is added? 1. SetError 2. ContainerControl 3. Error on errorProviderControlName 4. BlinkStyle Answer: 2. ContainerControl Ver. 1.0 Session 4 Slide 15 of 25
  • 16. GUI Applications Development Using .NET Framework Demo: Validating Data Problem Statement: SigmaCom is a telecommunication company which is developing software that would gather information about its employees. The company requires that the information entered should be correct and all the fields should be filled with required data and that no fields are left blank. Help the company to develop the required application. Ver. 1.0 Session 4 Slide 16 of 25
  • 17. GUI Applications Development Using .NET Framework Demo: Validating Data (Contd.) Solution: To meet the preceding requirement, you need to perform the following tasks: 1. Create a new VC# application. 2. Design the Employee Information form. 3. Add code to perform the desired tasks. 4. Execute the application and verify the output. Ver. 1.0 Session 4 Slide 17 of 25
  • 18. GUI Applications Development Using .NET Framework Introducing CommonDialog Classes • In VC#, the CommonDialog class is the base class for displaying common dialog boxes such as font dialog box, open dialog box, and save dialog box. Ver. 1.0 Session 4 Slide 18 of 25
  • 19. GUI Applications Development Using .NET Framework Types of CommonDialog Classes • There are various classes that are inherited from the CommonDialog class. These are: ColorDialog class FontDialog class FileDialog class OpenFileDialog class SaveFileDialog class FolderBrowserDialog class PrintDialog class Let us understand how these dialog boxes work. Ver. 1.0 Session 4 Slide 19 of 25
  • 20. GUI Applications Development Using .NET Framework Creating Custom Dialog Box In VC#, the user can create customized dialog boxes in order to perform some specific tasks. The Windows Forms Designer can be used for creating a custom dialog box with the following changes: – Assign a value of FixedDialog to the FormBorderStyle property of the form. – Assign a value of False to the ControlBox, MinimizeBox, and MaximizeBox properties of the form. – Assign an appropriate value to the DialogResult property for each button used on the form. Ver. 1.0 Session 4 Slide 20 of 25
  • 21. GUI Applications Development Using .NET Framework Just a minute All the classes that inherit from the CommonDialog class override the ___________ method to create a specific dialog box. Answer: RunDialog() Ver. 1.0 Session 4 Slide 21 of 25
  • 22. GUI Applications Development Using .NET Framework Demo: Creating Custom Dialog Box Problem Statement: Create an application that would accept the user input into a rich text box control. The application should have a Zoom button. This button should invoke a custom dialog box, which should accept a numeric value from a user. Whatever value is passed through the dialog box, the text in the rich text box control should get enlarged by that percentage. Ver. 1.0 Session 4 Slide 22 of 25
  • 23. GUI Applications Development Using .NET Framework Demo: Creating Custom Dialog Box (Contd.) Solution: To create the application, you need to perform the following tasks: 1. Create a new VC# application. 2. Design the main form. 3. Design a custom dialog box. 4. Add code in the custom dialog box. 5. Add code in the main form. 6. Execute the application and verify the output. Ver. 1.0 Session 4 Slide 23 of 25
  • 24. GUI Applications Development Using .NET Framework Summary In this session, you learned that: – Validation is a means to check the accuracy and the correctness of the data entered by the user. – The Validating event enables you to prevent the user from shifting the focus from the control being validated to some other control on the form until all validation rules have been met. – The MessageBox class is used to display prompts and messages on the screen. After closing the message box the user cannot see the message. – An instance of the MessageBox class cannot be created by using the new keyword. – The StatusStrip control is derived from System.Windows.Forms.ToolStrip class. It is a container control that can hold other controls. Ver. 1.0 Session 4 Slide 24 of 25
  • 25. GUI Applications Development Using .NET Framework Summary (Contd.) The StatusStrip control contains four types of controls. The controls are: • StatusLabel • ProgressBar • DropDownButton • SplitButton – The ErrorProvider control is used to display an error message, whenever the user positions the mouse pointer over the error icon. – The CommonDialog class is the base class for the most commonly used dialog boxes, such as, Color, Font, File, FolderBrowser, Print, and Page Setup. – A Custom dialog box can be created by setting some properties of the Windows Form such as, FormBorderStyle, ControlBox, MinimizeBox, and MaximizeBox. Ver. 1.0 Session 4 Slide 25 of 25

Editor's Notes

  1. Start the session by sharing the session objectives with the students.
  2. The faculty must explain to the students that validation is a very important and useful feature that can be added in Windows Form. Validation helps to ensure that the data entered by the users is accurate and as desired. Let us understand the concept of Validation with the help of an example. While entering student’s marks, the faculty must ensure that the marks entered within the text box are in the range 0-100. Also, the code should ensure that the faculty is restricted from entering text or special characters in the marks text box. If a faculty enters a value such as -5, 113, or ab!, it will be considered as invalid and it should not be allowed also. Therefore, code can be written to ensure that the faculty enters data only within the specified range. The faculty must prepare and present a demo to show that the data within the controls can be validated. Again you can take the simple example of an addition form. In this form if the user enters text or special characters in place of number, then an error should be raised.
  3. Reiterate the concepts taught earlier by asking the given question.
  4. Using the slide 4 th , 5 th 6 th, and 7 th , discuss with the students that while validating data, it is essential that proper messages should be displayed in order to specify that the user has entered invalid data. These messages can be displayed using MessageBox class. Discuss the Show() method of this class that is actually used to display messages. Discuss the parameters that can be used with this method to customize the appearance of the box that appears. You can also display a small example that shows the use of MessageBox.
  5. Reiterate the concepts taught earlier by asking the given question.
  6. Reiterate the concepts taught earlier by asking the given question.
  7. Using this slide and the next slide, the faculty should discuss the purpose and features of the StatusStrip control. This control should be used to specify messages that can help the user identify the correct data to be entered by the user. In addition, it provides other features also. The faculty must demonstrate an application with this control.
  8. The faculty must discuss the following properties of the StatusStrip Control: Items LayoutStyle Dock
  9. Reiterate the concepts taught earlier by asking the given question.
  10. Reiterate the concepts taught earlier by asking the given question.
  11. Using this slide, the faculty can explain the purpose of the ErrorProvider control. The faculty must explain that this control helps to highlight the error as well as specifies the control that has generated the error. The faculty must discuss the properties and methods of ErrorProvider control given in the SG.
  12. Reiterate the concepts taught earlier by asking the given question.
  13. Conduct the activity stated in the slide in a collaborative mode in the class.
  14. The faculty must explain the Common dialog boxes available in Windows.
  15. The faculty must present a demo on the working of some of these dialog boxes. The faculty can prepare a form with different buttons, each for a different dialog box. The faculty can use the code within the Student’s Guide to present the demo.
  16. The faculty can use this slide to explain the purpose of Custom Dialog Box. In addition, the faculty can tell the students that they can use this when they need to design their own dialog box. For example, in some application if the students need to connect to several databases regularly then in place of writing the code again and again, the user can create a custom open dialog box that accepts the name of the database and opens it up.
  17. Reiterate the concepts taught earlier by asking the given question.
  18. Conduct the activity stated in the slide in a collaborative mode in the class.
  19. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  20. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.