My program has 5 RadioButton
on one of the Panel
that I have not renamed and thus got Panel1
, so only one can be chosen.
I created a list with all RadioButtons
, after clicking a button I tried to use the code below to iterate the Tag
tag property:
// this.ListaRadios é minha lista de RadioButtons
var variacao = from item in this.ListaRadios //Esta parte dá erro:
// Could not find an implementation of the query pattern for source type
// 'System.Collections.Generic.List<System.Windows.Forms.RadioButton>'.
// 'Where' not found. Are you missing a reference or a using directive
// for 'System.Linq'?
where item.Checked = true
select (string)item.Tag;
In addition to the error you are experiencing, is there a more efficient way to do this?
How would a Linq to iterate only the RadioButtons
of a Panel
and then the only one marked?