Results 1 to 2 of 2

Thread: color dailog

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2014
    Posts
    169

    color dailog

    friends;
    Code:
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            
    If Me.ColorDialog1.ShowDialog = DialogResult.OK Then
                Me.BackColor = Me.ColorDialog1.Color
            End If
            MsgBox(Me.ColorDialog1.Color.ToString)
    End Sub

    i want to save Me.ColorDialog1.Color to a data base table this easy for me

    but i want to retrive this value for a form from my table
    as this example

    Code:
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
             Me.BackColor = the color that save to in the table
            'how can i do thatn
        End Sub

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,764

    Re: color dailog

    You can store the color as an integer using Color.ToArgb and then use Color.FromArgb once the integer value has been retrieved.

    Code:
            Dim acolor As Color = Color.AliceBlue
    
            Dim colorAsInteger As Integer = acolor.ToArgb 'store colorAsInteger
    
            acolor = Color.FromArgb(colorAsInteger)
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width