Saturday, 28 January 2012

Ho w to open color style box in vb.net?


Ho w to open color style box in vb.net?
This tutorial you can learn how to open color style box and show which color you selected in message box
Step1:
Open Microsoft visual studio 2010
Step2:
Open file new à windows form application à Rename the application
Step3:
Drag and drop one button
Step4:
Write or copy the below code to program window
Code:
Public Class Form1
    Private SubButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click

        Dim colordialog As New ColorDialog
        colordialog.ShowDialog()

        If colordialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim stringshow As String
            stringshow = colordialog.Color.Name
            'MsgBox(stringshow)
            MessageBox.Show(stringshow)

        End If

    End Sub


End Class

Output: