StrataFrame Forum

Listing form controls with binding and tooltip etc

http://forum.strataframe.net/Topic25093.aspx

By Charles R Hankey - 10/31/2009

Is there already a good utility or tool (or chunk of code I could steal ) that would allow for listing all the controls on a form, their databinding, type, tooltip (not a biggie)



I was thinking of extracting it from form's code itself, but I thought someone may have already done this and written code to do so??



( actually, this could be done with LINQ against the text of the form designer file ... hmmm ) Cool
By Paul Chase - 11/2/2009

If you are only concerned with Strataframe bound controls you could just loop through the forms business object collection and then loop through each BO's bound controls collection. Otherwise you would have to loop though the controls collection of the form and recurse through each control's control collection etc.

Here is a basic version of getting just the bound controls

Console.WriteLine("Only Bound Controls")

For Each LoBusobj As MicroFour.StrataFrame.Business.BusinessLayer In Me.BusinessObjects

For Each locontrol As System.Windows.Forms.Control In LoBusobj.BoundControls

Console.WriteLine("Control Name " & locontrol.Name)

Console.WriteLine("Binding Fld " & CType(locontrol, MicroFour.StrataFrame.UI.Windows.Forms.IBusinessBindable).BindingField)

Next

Next