Hello everyone,
I have a Panel whose Content is a Scrollable to which I add controls (buttons/labels/etc) at runtime. I now want to write a method with one method parameter that represents the ID of a control. The method must now loop through the controls in the Scrollable, searching for a control whose ID matches the method parameter, and then return the control.
In an old VB .NET app, it was done as follows:
Private Function FindControl(ByVal Name As String) As Control
Dim cRef As Control
For Each cRef In panMain.Controls
If cRef.Name = Name Then
Return cRef
End If
Next
Return Nothing
End Function
With a direct conversion to C#:
private Control FindControl(string Name)
{
Control cRef;
foreach (var cRef in panMain.Controls)
{
if (cRef.Name == Name)
return cRef;
}
return null;
}
What must I change for it to work correctly with Eto?