There are lots of articles about XML, dynamically adding forms and dynamically adding controls for vb.Net. But, if there's an article on how to dynamically define a form in XML, or other configuration settings, to dynamically create forms/subforms with all the controls and events, I've yet to find it; at least nothing that's impressed me as a clean, efficient and repeatable option.
The concept is that most of the forms in most database applications are nothing more than support forms. Configurations and lists used in the main form. Like a "Books" table, and an "Authors" table, maybe a "Bindings" table or "Paper Type" - bad examples, I know, but the point is that all these sub-forms are used to manage ancillary tables not related to the business application other than that they are used for the lists to make the main form
intelligible.
The main form will always need to be custom, but, all the lookup tables and forms should be able to be generated dynamically from some sort of setting repository. Be it an INI file, XML File, Registry, ConfigurationManager, whatever. An XML File could have a collection of <Forms> with it's settings, custom properties, etc., and a sub-collections of <controls> with all their settings (be it custom controls or out-of-box controls) with all their event definitions (probably calling some generic sub-routine). This way you can control your own look and feel for your application throughout.
I've tried several different methods on my own, but, I've not gotten far enough to have anything worth showing. There always seems to be some road-block that kills that particular chosen path. The closest I've gotten used something like:
Dim aButton As New System.Windows.Forms.Button()
Me.List.Add(aButton)
HostForm.Controls.Add(aButton)
aButton.Width = 49
aButton.Top = Count * 25
aButton.Left = 100
aButton.Tag = Me.Count
aButton.Text = "Button " & Me.Count.ToString
AddHandler aButton.Click, AddressOf ClickHandler
However, one problem with this method seems to require that you have the below code in your Form.Designer.vb (which gets wiped out often):
btnButtonArray = New ButtonArray(Me)
Granted, that's not obtained from settings, the values are hard-coded, but,
to build a house you have to build bricks first.
But, the problem with the above is that with a dynamically created form, there is no Form.Designer.vb.
So, I'm trying to find the pieces to fit together to build my complete solution.
Here's the question:
If you know of something that already does something similar, please point me in that direction; otherwise, do any of you have suggestions that will accommodate my intentions?
Thanks in advance,