Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Selected Index are maintained in C#.net.
Generally I try to solve such as
if(cmbName.SelectedIndex !=0)
{
Do something.
}

But when i need selected Index 0 for first element,I can't do that.
Have any Simple Solution.

Md.Mejbahur
Posted
Comments
zyck 7-Feb-12 1:51am    
what do you want to achived? if you selected index 0 then?

You need to use -1 here -> if(cmbName.SelectedIndex !=-1).
This should help you out.
 
Share this answer
 
use
SQL
if(cmbName.SelectedIndex !=-1)
{
Do something.
}


-1 indicates no selection
 
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