Question using ColorDialog tool, is any color change by the user always temporary

razz

Well-known member
Joined
Oct 11, 2008
Messages
67
Programming Experience
Beginner
In VB 2008, I used the ColorDialog tool to facilitate the user being able to change the color of pages. Is this change of color always temporary or can some code be added so the change of color becomes permanent until he/she may change it again?

Thank you for your time.
 
My.Settings can be used.
 
Add a User scoped setting of type Color. You can also bind the form Backcolor property to this setting, see this recent thread about this: http://www.vbdotnetforums.com/windows-forms/29901-need-help-initial-startup-form.html. Now if you change the setting value the form backcolor also changes, or if you change the form backcolor the setting value is also changed.
Thank you for your help John. Unfortunately I am very new to all this stuff, so I require more detail for some of the things you mention in order for me to understand (I read the post you mentioned but still don't understand what I need to do). Would it be possible for you to lead me through this procedure step-by-step?
The end result I am hoping to achieve is: for the user to be able to change color permanently, until he/she may change it again.

Thank you so much for your help.
 
Here is also another thread that deals with same, with screenshots too, http://www.vbdotnetforums.com/windows-forms/17226-setting-color-value.html
I read what you suggested and I am now close but not quite there yet. Currently, I have my "Change Color" button changing color and maintaining that color until I it change again. This is close, but not what I wish to do. I want the page changing color, not the button. I have included 2 screen shots.
Please advise what I need to change in my code. Thank you!
View attachment sc1.bmp
View attachment sc2.bmp
 
I want the page changing color, not the button.
What do you mean exactly? Do you want to use the Click event of form instead of Button?

I see you're also not familiar with dialogs, what you want to do is act depending on the result of the ShowDialog function call, usually you only do something if the user has confirmed the dialog with OK or similar:
VB.NET:
If coldialog.ShowDialog = Windows.Forms.DialogResult.OK Then
  'dialog is confirmed, ok to proceed
End If
 
I am sorry my response has taken so long, I was on vacation.

I am still confused as to what to do...I realize how frustrating it must be trying to help novices like me, and I'm sorry for that. I'm doing my best and I thank you for your patience.

I am posting the code for one my entire pages (my main console page) and perhaps that will help you to show me what I need to do to accomplish the task of enabling users to permanently changing colors on pages if they so desire.

My code is as follows (all works great except the color change is only temporary:
VB.NET:
[COLOR="Navy"]Public Class MainConsole

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        PerformDaily.Show()
        Me.Hide()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        PerformWeekly.Show()
        Me.Hide()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        CommonTasks.Show()
        Me.Hide()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        PerformMonthly.Show()
        Me.Hide()
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    End Sub

    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutButton.Click
        About.Show()
        Me.Hide()
    End Sub

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        Info.Show()
        Me.Hide()
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        WhatsRunning.Show()
        Me.Hide()
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        MoreLinks3.Show()
        Me.Hide()
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        UninstallPrograms.Show()
        Me.Hide()
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        Backup.Show()
        Me.Hide()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Defrag.Show()
        Me.Hide()
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        Security.Show()
        Me.Hide()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        ColorDialog1.ShowDialog()
        Me.BackColor = ColorDialog1.Color
    End Sub
End Class[/COLOR]
 
Back
Top