Welcome to Dream.In.Code
Become a C# Expert!

Join 150,399 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 987 people online right now. Registration is fast and FREE... Join Now!




How can i control combobox index

 
Reply to this topicStart new topic

How can i control combobox index

kingmighty_spades
3 Mar, 2008 - 03:53 PM
Post #1

New D.I.C Head
*

Joined: 8 Feb, 2008
Posts: 20


My Contributions
Hi,
I have a toolStripcombobox that show the color list to user .
but when the user select a color of this list it doesn't change anything:
this is code which i witre in toolStripcombobox :

CODE

        private void toolStripcmdTextColor_Click(object sender, EventArgs e)
        {
            //comboBox e entekhabe rang dakhele forme pm
            switch (toolStripcmdTextColor.SelectedIndex)
            {
                case 0: clrText = Color.Black;
                    break;
                case 1: clrText = Color.Red;
                    break;
                case 2: clrText = Color.Blue;
                    break;
                case 3: clrText = Color.Yellow;
                    break;
                case 4: clrText = Color.Green;
                    break;
                case 5: clrText = Color.Orange;
                    break;
                case 6: clrText = Color.Pink;
                    break;
            }
        }


for exampel if user select blue we get in code (breakpoint mode) red!!!!
anyone any idea???!!!!!!!

thanks and i be waiting for your help

User is offlineProfile CardPM
+Quote Post

Jayman
RE: How Can I Control Combobox Index
3 Mar, 2008 - 03:58 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,327



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
What is clrText? Is that a TextBox?
User is offlineProfile CardPM
+Quote Post

kingmighty_spades
RE: How Can I Control Combobox Index
3 Mar, 2008 - 04:19 PM
Post #3

New D.I.C Head
*

Joined: 8 Feb, 2008
Posts: 20


My Contributions
QUOTE(jayman9 @ 3 Mar, 2008 - 04:58 PM) *

What is clrText? Is that a TextBox?


Hi Jayman

Color clrText;
User is offlineProfile CardPM
+Quote Post

Jayman
RE: How Can I Control Combobox Index
3 Mar, 2008 - 06:14 PM
Post #4

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,327



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
What are you trying to color change when the user picks a color from the combobox?

Currently, all you are doing is assigning a color to a Color object. You still need to apply the color to something.

Post your code.
User is offlineProfile CardPM
+Quote Post

kingmighty_spades
RE: How Can I Control Combobox Index
4 Mar, 2008 - 02:44 AM
Post #5

New D.I.C Head
*

Joined: 8 Feb, 2008
Posts: 20


My Contributions
QUOTE(jayman9 @ 3 Mar, 2008 - 07:14 PM) *

What are you trying to color change when the user picks a color from the combobox?

Currently, all you are doing is assigning a color to a Color object. You still need to apply the color to something.

Post your code.


Hi, when i get color from user i want show the color in a richtextbox and my code in which i wirte in first post



thanks and i be waiting for your help

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 06:42PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month