1,105,402 Community Members

Change label forecolor through selected combobox item..

Member Avatar
Ahmed.C
Junior Poster in Training
67 posts since Aug 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi guys. I just need help with something. Bascailly I've got a combobox which has all the colors e.g. color.black, color.blue etc and what I want to do is when the user selects the combobox item e.g. selected color.Blue it should change the labels forecolor to what ever the user selected. i.e. blue but i get an error: Here's what i mean: http://puu.sh/4hVTV.png

Question Self-Answered as of 7 Months Ago
Member Avatar
Ahmed.C
Junior Poster in Training
67 posts since Aug 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Basically this s what I added :
I added this code below to the selectedindexchanged in a combobox.

  Dim c As Color       
           c = Color.FromName(ComboBox1.SelectedItem.ToString)
            Label7.ForeColor = c

In my combobox I've loaded all the colors e.g. color.blue, color.black etc and when I choose one of the colors it changes label7's forecolor to whatever item I choose. I hope this helps anyone out there who was in a similar situation as I was. Enjoy :P

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article