c# - I can't disable checkbox? -


i can't disable checkbox...

public  void seat_reser_load(object sender, eventargs e) {     string asd = "";      datatable dt = ob.dataview("select * seat_res bus_id='"+ bus_select.id+"'and date='"+bus_select.date +"'");      foreach (datarow d in dt.rows)     {         asd += d[2].tostring();    // d[2] seat column         asd+=",";     }      box[0] = checkbox1;     box[1] = checkbox2;     box[2] = checkbox3;     box[3] = checkbox4;     box[4] = checkbox5;     box[5] = checkbox6;     box[6] = checkbox7;     box[7] = checkbox8;     box[8] = checkbox9;     box[9] = checkbox10;     box[10] = checkbox11;     box[11] = checkbox12;     box[12] = checkbox13;     box[13] = checkbox14;     box[14] = checkbox15;     box[15] = checkbox16;     box[16] = checkbox17;     box[17] = checkbox18;     box[18] = checkbox19;     box[19] = checkbox20;     box[20] = checkbox21;     box[21] = checkbox22;     box[22] = checkbox23;     box[23] = checkbox24;     box[24] = checkbox25;      (int h = 0; h < box.length; h++)     {         box[h].enabled = true;     }      string[] n = asd.split(',');      (int = 0; < n.length; i++)     {         (int j = 0; j < box.length; j++)         {             if (n[i] == box[j].text)             {                 box[j].enabled = false;                 j++;             }             else if (!(box[j].enabled == false))             {                 box[j].enabled = true;             }         }     } } 

your code seems fine, did want set checkbox's visibility or checked state false, instead of disabling it? did want make invisible or unchecked?

in case might want change usage of enabled visible or checked, example, this:

box[h].visible = false; box[h].checked = false; 

what's difference between enabled, checked , visible?

enabled - enable/disable checkbox, cannot check or uncheck checkbox if disabled, however, checkbox still visible on screen

checked - check/uncheck checkbox, it's identical user clicking checkbox

visible - make checkbox visible/invisible, user cannot see control, nor can click on or interact in way


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -