Couldn't the following code be done (and done better) with LINQ/func delegate? I'm fairly new to LINQ/func. I'm looping through all the controls on the form to find all the FlowLayoutPanels (they're embedded in tabs and split containers) and saving the control index information to the application settings so it can be recalled upon loading. My app allows the user to reposition their GUI/controls with drag drop. *Note, ServicingLayout
is my own serializable class with info I need to restore the user's preference.
Private Sub SaveFlow(ByVal F As FlowLayoutPanel) Handles Me.FoundFlow
For Each C As Control In F.Controls
My.Settings.ServicingLayout.AddControl(F.Name, C.Name, F.Controls.GetChildIndex(C))
Next
End Sub
Private Event FoundFlow(ByVal F As FlowLayoutPanel)
Private Sub SaveFlowLayouts(ByVal CC As Object)
For Each C As Control In CC
If TypeOf C Is FlowLayoutPanel Then RaiseEvent FoundFlow(C)
If C.Controls.Count > 0 Then SaveFlowLayouts(C.Controls)
Next
End Sub
Thank you!