VB 2005: ColorDialog, FontDialog

Posted on 2006-05-02
Last Modified: 2007-12-19
How does one use these dialogs?

When the user has made there selection, how and where is it held?

Thanks in advance...
Question by:murbro
    LVL 12

    Expert Comment


    the solution is in C#  let me know if you have problem converting it to VB

    Author Comment


    Thanks for that, but I need it in visual basic.
    LVL 12

    Assisted Solution

    Here for the color dialog

            Dim ColorDialog1 As ColorDialog = New ColorDialog
            ColorDialog1.AllowFullOpen = True
            ColorDialog1.FullOpen = True
            ColorDialog1.ShowHelp = True
            'Set the initial color select to the current text color,
            'so that if the user cancels out we will restore the original color.
            ColorDialog1.Color = Color.DarkBlue
            Dim clr As System.Drawing.Color = ColorDialog1.Color

    LVL 85

    Accepted Solution

    Simple as...

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

        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
                Me.Font = FontDialog1.Font
            End If
        End Sub

    Author Comment

    Thanks very much gbxhhu. Idle Mind, thanks very much for the simplification!

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now