c# - Return ComboBox as Boolean -


i know not best practice use boolean combobox application returns data yes/no thats required. i'm trying return whether yes or no getting warning 'possible unintended reference' cleaning code appreciated.

public bool playdatatoend {         {         return this.playdatatoend.selectedvalue == "yes";     }     set     {         this.playdatatoend.selectedvalue = true;     } } 

suppose internal combobox named playdatatoendcombo:

public bool playdatatoend {         {         return playdatatoendcombo.selectedvalue.tostring() == "yes";     }     set     {         playdatatoendcombo.selectedvalue = value ? "yes" : "no";     } } 

i think should use index convention: 0 yes , 1 no:

public bool playdatatoend {         {         return playdatatoendcombo.selectedindex == 0;     }     set     {         playdatatoendcombo.selectedindex = value ?  0 : 1;     } } 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -