TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Agile Developer
NA
21
3.8k
Combo box color not being applied to text
May 4 2014 1:49 PM
Hello,
I have a combo box which lists all the known windows color. I want the selected color combo box color stored and applied to a string in another location.
The following method adds color to a combo box I have in a form -
private void _tlpMain_Paint(object sender, PaintEventArgs e)
{
foreach (System.Reflection.PropertyInfo prop in typeof(Color).GetProperties())
{
if (prop.PropertyType.FullName == "System.Drawing.Color")
_cmbgroupcolor.Items.Add(prop.Name);
String groupcolor = (string)_cmbgroupcolor.SelectedItem; //store color
}
In the last line I am trying to store the color in a variable.
In another class, I want to call this color -
node.ForeColor = groupcolor; //add color to text
I am getting an error saying the "groupcolor" is not found in the current context. I need to somehow make it public so this other class can find it. They are in the same namespace.
Thank you.
Reply
Answers (
12
)
Search ListView
how to add signature 'on an assembly using certificate in c#