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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -