Click here to Skip to main content
15,923,164 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) //combobox Select Index
       {
           if (ddl_CircularType != 'Send to Individual') //Condition
           {
               ddl_Department.Enabled = true;  
//i want to show this value on screen when i select this value in combobox2
           }
           else if (ddl_CircularType !='Send to Particular Department')
           {
               ddl_Department.Enabled = true;
               ddl_EmployeeID.Enabled=true;
               ddl_EmployeeName.Enabled=true;
           }
           else if (ddl_CircularType != 'Send to All Employee')
           {
               ddl_Department.Enabled = true;
                ddl_EmployeeID.Enabled=true;
               ddl_EmployeeName.Enabled=true;
           }

       }
Posted
Updated 16-Jan-15 22:05pm
v6
Comments
OriginalGriff 17-Jan-15 3:29am    
And?
What is the problem?
What have you tried?
Where are you stuck?


Remember that we can't see your screen, access your HDD, or read your mind.
So all we get to work from is whet you type here.
(ANd BTW: multiple exclamation marks are a sign of a diseased mind...)
hari om singh 17-Jan-15 3:34am    
combo box property is Visible False
and i want to show these combo box when i Select a particular Value
i.e. i want to show combobax when i select "Send to Individual" then i want to show " ddl_Department"
OriginalGriff 17-Jan-15 3:54am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalization if you want to be taken seriously.
I have removed the shouting from your title.

1 solution

Try:
C#
if (ddl_CircularType != "Send to Individual")
           {
               ddl_Department.Visible = true;
           }
 
Share this answer
 
Comments
hari om singh 17-Jan-15 4:07am    
I Got Error
Too many characters in character literal
and it was shoing eror where i was define Condition
OriginalGriff 17-Jan-15 4:14am    
That's because you were using single quotes around your string:
if (ddl_CircularType != 'Send to Individual') //Condition
If you look at my version is has double quotes:
if (ddl_CircularType != "Send to Individual")
Single quote ' indicates a character to C#: 'A', 'B', 'C', 'S', 'e', 'n', 'd', ' ', ...
Double quote " indicates a string to C#: "ABC", "XYZ", "Send to Individual"
OriginalGriff 17-Jan-15 4:15am    
BTW: In future, if you get a specific error message, it's a very good idea to tell us, and show us the message - it makes working out your problem a lot easier, and that means quicker for you!
hari om singh 17-Jan-15 4:20am    
Sir when we aply this code i get this error
Operator '!=' cannot be applied to operands of type 'System.Windows.Forms.ComboBox' and 'string'
hari om singh 17-Jan-15 4:25am    
Sir may be you cud not understand my problem
when i select a specific value then textbox or combo box going to visible
and when i select any other value then other textbox or combo box is goes visible
Basicly I got problem in deifining the condition

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900