3.1. My typical VB.NET desktop application. How to overcome VS Designer lost link to controls.
Usually VS Designer lost link to form control in code. EmailCenterSubformDataGridView will be not accessible in form core.
For overcom this issue I create a separate file with definition of forms components deleted by designer.
And use this extension
5: <Extension()>
6: Public Function FindRecusriveByType(ByVal control As Control, ByVal type As Type) As IEnumerable(Of Control)
7: Dim controls = control.Controls.Cast(Of Control)()
8: Return controls.SelectMany(Function(ctrl) FindRecusriveByType(ctrl, type)).Concat(controls).Where(Function(c) c.[GetType]() = type)
9: End Function
to restore link between form code and code designer.
15: EmailCenterSubformDataGridView = Me.FindRecusriveByType(GetType(DataGridView)).First17: AttachmentListListView = Me.FindRecusriveByType(GetType(ListView)).First
Comments (
)
Link to this page:
//www.vb-net.com/Samantha/DesignerLostLink.htm
|