Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 2 - Exploring the Dialogs Controls in Vb.Net
Moblin
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Exploring the Dialogs Controls in Vb.Net
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2006-07-11

    Table of Contents:
  • Exploring the Dialogs Controls in Vb.Net
  • ColorDialog Control
  • OpenFileDialog Control
  • Usage of these Controls

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Exploring the Dialogs Controls in Vb.Net - ColorDialog Control


    (Page 2 of 4 )

    Again as the name suggests, when this control is called up, it will show a color-pick dialog, Color, where you can pick a color that can be applied to the object's color related properties. This can be the backcolor of a text box for example, or the form's backcolor, or forecolor, and so forth.

    The next picture shows the class view of the ColorDialog class. Again you can trace it back to the CommonDialog control in the inheritance chain. There are many properties, out of which only the Color() property is used. The ShowDialog() is however inherited from the CommonDialog.

    Now to the above project add another button, and after dragging and dropping a ColorDialog control onto the form, add the following code to the click event of the button:

    Private Sub Button1_Click(ByVal sender As System.Object, 
    ByVal e As _ System.EventArgs) Handles Button1.Click ColorDialog1.ShowDialog() If Windows.Forms.DialogResult.OK
    Then Me.TextBox1.BackColor = ColorDialog1.Color End If End Sub

    The first line of code, ColorDialog1.ShowDialog() pops up the Color pick window shown earlier. When you make the choice and click OK, the Windows form gets the message and applies the ColorDialog's Color() property (the color chosen) to the Backcolor property of the text box control. When you build and run the form, it shows with the two buttons, one for the font and one for the color. Clicking the Font button creates some text in the text box, and by clicking the color button and applying a light blue color you will see the following.

    FolderBrowserDialog, OpenFileDialog and SaveFileDialog Controls

    These dialogs will be briefly discussed, and in the last part of the project all these controls will be used, which accomplishes the following. The FolderBrowserDialog Control will open a browser from which a folder will be chosen. The OpenFileDialog will open a file from the folder and will be passed on to a web browser control to display a web page. The chosen file can then be saved to a chosen location using the SaveFileDialog control.

    FolderBrowserDialog Control

    When you call up this control it will pop up a Browse For Folder dialog as shown in the next picture, from which you can choose a folder, a sub-folder and any other nested folder. The path to this folder is now captured in this object's SelectedPath() property which can be accessed by code.

    This next picture shows you the class view of the FolderBrowserDialog class and its members in the right panel. You can instantiate using the NEW() keyword.

    More Visual Basic.NET Articles
    More By Jayaram Krishnaswamy


       · Being descendents of CommonDialog Controls, these controls should be faimliar to...
     

    VISUAL BASIC.NET ARTICLES

    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...
    - Creating and Drawing a Game Map in VB.NET
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...

    Iron Speed




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway