Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleUse the color selection dialog in VB .NET
Keywordscolor, select color, pick color, color selection, color selection dialog, VB.NET
CategoriesGraphics, VB.NET, Software Engineering
 
Add a ColorDialog control to the form. To use it, set its Color property to the color you want it to have initially selected. Then call the control's ShowDialog method. If the method returns DialogResult.OK, do something with the color that the user selected.
 
Private Sub btnPickColor_Click(ByVal sender As _
    System.Object, _
 ByVal e As System.EventArgs) Handles btnPickColor.Click
    dlgColor.Color = Me.BackColor
    If dlgColor.ShowDialog() = DialogResult.OK Then
        btnPickColor.BackColor = dlgColor.Color
        Me.BackColor = dlgColor.Color
    End If
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated