Gurus out there.
I'm quite new to winforms with .NET with visual studio and I'm stuck with an issue.I would like to select checkboxes not by Design name but by parameters. More specifically, I would like to check the checkboxes which has the parameters which are also in the data retrieved from the database.
Example code :
(checkBox) C1.checked = true;
This is how I can set checked right now,
but I want to do something like...
string[] datas = db.getData();
foreach (string data in datas) {
if (data.Equals("C1")) {
C1.checked == true;
}
}
Of course I can do this for every checkboxes, but there are over 50 checkboxes and I think it's stupid to manually checking this but I couldn't find a way to select a particular checkbox based on the name.
Also, it would be really helpful if someone knows a way to group the textboxes, so that I don't have to loop over every checkboxes every time.
There's gotta be a way.. Help me bros!
Aucun commentaire:
Enregistrer un commentaire