Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
im using if statment and in this Cmboboxtype.SelectedIndex ==0 shwing an error (Warning 2 Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'string')


if (txtBoxQuestion.Text == "" || txtbxchoice1.Text == "" || txtbxchoice2.Text == "" || txtbxchoice3.Text == "" || txtbxchoice4.Text == "" || Cmboboxtype.SelectedIndex ==0)
             {
                 MessageBox.Show(" Please Fill All TEXT BOXES");
             }
Posted
Updated 6-Mar-15 22:42pm
v2
Comments
Krunal Rohit 7-Mar-15 4:06am    
What ?

-KR
Member 11504333 7-Mar-15 4:21am    
im trying to create an application in which im using a combo-box and in database. i have two tables i want to repeat same id in both tables by that single combo-box which im using in from1. how can access the same value select by form1 can us in form2.......

1 solution

Just use

C#
Cmboboxtype.SelectedItem="Choose Item...";


Or you may use selectedindex

C#
Cmboboxtype.SelectedIndex=0 ; //or 1,2,3 index of the item
 
Share this answer
 

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