Devo fare che:
creo 5 user control, chiamati timesheet_1, timesheet_2,timesheet_3,timesheet_4,timesheet_5
e voglio che tutti si devono nascondere (con .hide()) e solo timesheet_2 deve essere visualizzato.
ecco il mio codice, che non ha funzionato:
ma la cosa strana è che visualizzando il nome della userform, esce timesheet_22 non timesheet_2codice:foreach (var c in this.Controls) { if (c is UserControl) { var x = (UserControl)c; // x.Hide(); if (x.Name == "timesheet_2") { x.Show(); } else { x.Hide(); } break; } }