Logo

Navigation
  • Home
  • Services
    • ERP Solutions
    • Implementation Solutions
    • Support and Maintenance Solutions
    • Custom Solutions
    • Upgrade Solutions
    • Training and Mentoring
    • Web Solutions
    • Production Support
    • Architecture Designing
    • Independent Validation and Testing Services
    • Infrastructure Management
  • Expertise
    • Microsoft Development Expertise
    • Mobile Development
    • SQL Server Database and BI
    • SAP BI, SAP Hana, SAP BO
    • Oracle and BI
    • Oracle RAC
  • Technical Training
    • Learn Data Management
      • Business Intelligence
      • Data Mining
      • Data Modeling
      • Data Warehousing
      • Disaster Recovery
    • Learn Concepts
      • Application Development
      • Client Server
      • Cloud Computing Tutorials
      • Cluster Computing
      • CRM Tutorial
      • EDI Tutorials
      • ERP Tutorials
      • NLP
      • OOPS
      • Concepts
      • SOA Tutorial
      • Supply Chain
      • Technology Trends
      • UML
      • Virtualization
      • Web 2.0
    • Learn Java
      • JavaScript Tutorial
      • JSP Tutorials
      • J2EE
    • Learn Microsoft
      • MSAS
      • ASP.NET
      • ASP.NET 2.0
      • C Sharp
      • MS Project Training
      • Silverlight
      • SQL Server 2005
      • VB.NET 2005
    • Learn Networking
      • Networking
      • Wireless
    • Learn Oracle
      • Oracle 10g
      • PL/SQL
      • Oracle 11g Tutorials
      • Oracle 9i
      • Oracle Apps
    • Learn Programming
      • Ajax Tutorial
      • C Language
      • C++ Tutorials
      • CSS Tutorial
      • CSS3 Tutorial
      • JavaScript Tutorial
      • jQuery Tutorial
      • MainFrame
      • PHP Tutorial
      • VBScript Tutorial
      • XML Tutorial
    • Learn Software Testing
      • Software Testing Types
      • SQA
      • Testing
  • Career Training
    • Career Improvement
      • Career Articles
      • Certification Articles
      • Conflict Management
      • Core Skills
      • Decision Making
      • Entrepreneurship
      • Goal Setting
      • Life Skills
      • Performance Development
      • Personal Excellence
      • Personality Development
      • Problem Solving
      • Relationship Management
      • Self Confidence
      • Self Supervision
      • Social Networking
      • Strategic Planning
      • Time Management
    • Education Help
      • Career Tracks
      • Essay Writing
      • Internship Tips
      • Online Education
      • Scholarships
      • Student Loans
    • Managerial Skills
      • Business Communication
      • Business Networking
      • Facilitator Skills
      • Managing Change
      • Marketing Management
      • Meeting Management
      • Process Management
      • Project Management
      • Project Management Life Cycle
      • Project Management Process
      • Project Risk Management
      • Relationship Management
      • Task Management
      • Team Building
      • Virtual Team Management
    • Essential Life Skills
      • Anger Management
      • Anxiety Management
      • Attitude Development
      • Coaching and Mentoring
      • Emotional Intelligence
      • Stress Management
      • Positive Thinking
    • Communication Skills
      • Conversation Skills
      • Cross Culture Competence
      • English Vocabulary
      • Listening Skills
      • Public Speaking Skills
      • Questioning Skills
    • Soft Skills
      • Assertive Skills
      • Influence Skills
      • Leadership Skills
      • Memory Skills
      • People Skills
      • Presentation Skills
    • Finding a Job
      • Etiquette Tips
      • Group Discussions
      • HR Interviews
      • Interview Notes
      • Job Search Tips
      • Resume Tips
      • Sample Resumes
 

Dialog Boxes in Visual Basic .NET

By Exforsys | on June 21, 2005 |
VB.NET 2005

Dialog Boxes in Visual Basic .NET

Most Windows applications request for user input. Dialog boxes are one means of requesting users for specific kinds of inputs. Therefore, VB.NET allows its designers to create a number of different types of dialog boxes. Standard Dialog boxes are included in classes that fall within the purview of the CommonDialog.

  1. FileDialog
  2. ColorDialog
  3. FontDialog
  4. PageSetupDialot
  5. PrintDialog

Let us now briefly study the features of the CommonDialog boxes

OpenFileDialogClass

This class provides users with the file selection capability. The properties and methods of this dialog boxes are given below:

Property or Method

Description

ShowDialog

Displays the dialog

MultiSelect

Sets/unsets the selection of multiple files

ShowReadOnly

Sets/unsets the read-only check box checked

Filter

Sets the type of files that will appear in the dialog box

FilterIndex

Sets the index of the filter selected in the dialog box

SaveFileDialog Class

The SaveFileDialog class offers you the standard window that we see while saving the file. The methods and properties of this dialog box are given below:

Property or Method

Description

ShowDialog

Displays the message

CheckFileExists

Checks for the existence of file specified

FileName

Determines the file name selected by the user

Filter

Condition for files to be shown in the dialog box

FilterIndex

Determine the index of the filter selected in the dialog box

The ColorDialog Class

This dialog box shows the color palette for allowing user to select a color and add that color to the palette. The properties of the Class are given below:

Property or Method

Description

ShowDialog

Displays the dialog box

Color

Determines the color selected by the user

AllowFullOpen

Specifies if the user can add custom colors to the box

SolidColorOnly

Determines if the user can use dithered colors

The following screenshot shows the usage of the color palette:

Create a new Visual Basic Windows Applications project in the Visual Studio IDE . To the form Form1 add a ColorDialogBox. Add two Buttons and name them as given below:

Now in the code behind form add the following codes:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Me.ColorDialog1.ShowDialog()

Label1.ForeColor = Me.ColorDialog1.Color

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Me.Close()

End Sub

End Class

Press F5 to execute the program

The three screenshots below illustrate how different common dialog boxes are displayed..

“Change Color” button opens the ColorDialog box. You can choose any color from the palette and click Ok. (The codes for event handling of Ok and Cancel button in the ColorDialogBox are not given in this program. You may however write it as shown earlier, if you want to see the impact of your program.) The next screenshot will show the changed fore color of the label1:

Creating a Custom Dialog Box

  • In a new project which already has a form Form1, add another form and name it as FixeDialog.
  • Set the Text property of this form as “Add Text”.
  • Add a label control, a text box control and two command buttons.
  • Change the text property of the label to “Enter Your Text!” and name the first button OK and the other as Cancel.
  • In the property sheet of the form set the FormBorderStyle property to FixedDialog
  • Set the ControlBox property as false. This is done to remove minimize, maximize and close buttons.
  • Enter the following codes for the Dialog Form:

Click here for the Sample Code

Now press F5 to execute the program. The Following sequence of three screenshot will illustrate the working of the form:

The first screenshot shows the initial screen of the program:

The following screenshot shows the custom dialog box opened with the new text typed in the text box:

The final screenshot shows the changed label text as shown below:

« « Common Controls and Handling Control Events
Oracle Apps Flex fields » »

Author Description

Avatar

Editorial Team at Exforsys is a team of IT Consulting and Training team led by Chandra Vennapoosa.

Free Training

RSSSubscribe 394 Followers
  • Popular
  • Recent
  • Visual Studio.NET Namespaces

    June 7, 2005 - 0 Comment
  • .NET Assemblies

    July 7, 2005 - 0 Comment
  • .NET Common Windows Forms Controls Part 2

    July 2, 2005 - 0 Comment
  • Using XML Data

    July 14, 2005 - 0 Comment
  • Customizing Setup Project in Visual Studio.NET 2005

    August 4, 2005 - 0 Comment
  • Visual Studio Windows Forms Designer

    June 7, 2005 - 0 Comment
  • Simple Data Binding

    July 7, 2005 - 0 Comment
  • Working with Menu Controls

    July 3, 2005 - 0 Comment
  • Web Services – SOAP, WSDL, Disco and UDDI

    July 16, 2005 - 0 Comment
  • Deploying Windows Applications In Visual Studio.NET 2005

    August 3, 2005 - 0 Comment
  • Microsoft .NET Creating Installation Components

    August 10, 2005 - 0 Comment
  • Shared Assembly

    August 9, 2005 - 0 Comment
  • The File Types Editor

    August 9, 2005 - 0 Comment
  • Tracing VB.NET Windows Application

    August 9, 2005 - 0 Comment
  • VB.NET Windows Application Testing

    August 9, 2005 - 0 Comment
  • The Registry Editor in Visual Studio.NET 2005

    August 4, 2005 - 0 Comment
  • Customizing Setup Project in Visual Studio.NET 2005

    August 4, 2005 - 0 Comment
  • Deploying Windows Applications In Visual Studio.NET 2005

    August 3, 2005 - 0 Comment
  • Debugging Windows Applications In Visual Studio.NET 2005

    August 3, 2005 - 0 Comment
  • Working with Legacy Code and COM Components

    July 30, 2005 - 0 Comment

Exforsys e-Newsletter

ebook
 

Related Articles

  • Microsoft .NET Creating Installation Components
  • Shared Assembly
  • The File Types Editor
  • Tracing VB.NET Windows Application
  • VB.NET Windows Application Testing

Latest Articles

  • Project Management Techniques
  • Product Development Best Practices
  • Importance of Quality Data Management
  • How to Maximize Quality Assurance
  • Utilizing Effective Quality Assurance Strategies
  • Sitemap
  • Privacy Policy
  • DMCA
  • Trademark Information
  • Contact Us
© 2023. All Rights Reserved.IT Training and Consulting
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptReject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT