int count = (panel_admin_vivod.Controls as CheckBox) .Count I get an error How to select the checkbox from the panel

  • In a loop on all elements of the panel and compare each on the CheckBox? - TEA
  • You somehow go from the reverse. You should know how many controls you have and manage them manually (have a link to each one), and not count them (they do not appear themselves?) - Andrey NOP
  • I agree! This is the same collection, and it needs to be iterated by element by element - user293746
  • I need to know the quantity in order to know which line and associate textboxes with the selected checkbox - user293746

1 answer 1

You can get all the elements of a certain type for example through LINQ:

var items = Controls.OfType<CheckBox>(); 

But I agree with the commentators, it is better to create elements and have an already defined collection, rather than load them from the form and only then work.