c# - Readonly properties -
hi here try make method can loop on form , convert text box enter image description here read only=true read = false not working public static void unread only(form frm) { foreach (control item in frm.controls) { if (item textbox) { // item.readonly = false; } } } primarily problem not casting control textbox have access property want set. foreach (control item in frm.controls) { if (item textbox) { var textbox = item textbox; textbox.readonly = false; } } that said, controls can contain child control, need crawl entire form looking embedded text boxes. this check form , controls text boxes , set them read only public static void setreadonly(control frm) { var controls = new queue<control>(); controls.enqueue(frm); while (controls.count > 0) { var control = controls.dequeue(); if (control textbox) { ...