I have one form where I have the need to modify the same fields above but for different BOs. I though that this would be the case to use a User Control, so I created one base on MicroFour.StrataFrame.UI.Windows.Forms.UserControl, then I implemented IBusinessBindable. Here is where I am confuse, I need to bind several fields, so should I add a property to this user control for each field that needs to be bind?
I have been checking the PeopleLookupControl.vb in StrataFlix but in that sample only one control is basically bound and still it is not clear to me.
Here is screenshot of the user control:
Please advise if I am going in the wrong direction here.
Thanks!
After reviewing your sample, it all was much clear to me and in fact it worked pretty well. One thing different in my designed is that the same user control is used with 2 BOs one at a time, so I had to manage that in the form where the user control is used and assign the proper BO instance.
Of course this kind of solution may no be the easiest or the most practical, but it is always good to know how to go deep in the code to make it work.
For the sake of others, here is the final code for the User Control class:
Imports System.ComponentModelImports FixTrack.BusinessNamespace UI.Windows.Forms Public Class QBCustomerInfo#Region " Constructors " Public Sub New() Me.InitializeComponent() End Sub#End Region #Region " Private Fields " Private _BusinessObject As MicroFour.StrataFrame.Business.BusinessLayer Private _CustomerNameText As String#End Region #Region " Public Properties " ''' <summary> ''' Define the base business object. ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> <Category("StrataFrame: Framework")> _ <Description("Set the BusinessObject that will supply the name data.")> _ Public Property BusinessObject() As MicroFour.StrataFrame.Business.BusinessLayer Get Return _BusinessObject End Get Set(ByVal value As MicroFour.StrataFrame.Business.BusinessLayer) _BusinessObject = value '-- Bind to our user controls to this BO If value IsNot Nothing Then If value.GetType Is GetType(bizCustomers) Then Me.tgbGeneralInfo.Title = "FixTrack Customer record information" Me.txtCustomerName.Enabled = True Me.txtCustomerName.BusinessObject = value Me.txtCustomerFax.BusinessObject = value Else Me.tgbGeneralInfo.Title = "FixTrack Building Address record information" Me.txtCustomerPhone.BindingField = "SuperPhoneNumber" End If Me.txtCustomerName.Enabled = False Me.txtCustomerStreet.BusinessObject = value Me.txtCustomerCity.BusinessObject = value Me.txtCustomerZip.BusinessObject = value Me.txtCustomerPhone.BusinessObject = value Me.txtQB_RefID.BusinessObject = value Me.txtCustomereMail.BusinessObject = value End If End SetEnd Property ''' <summary>''' This property is used to update the Customer Name textbox''' </summary>''' <value></value>''' <returns></returns>''' <remarks></remarks>Public Property CustomerNameText() As String Get Return _CustomerNameText End Get Set(ByVal value As String) _CustomerNameText = value Me.txtCustomerName.Text = _CustomerNameText End SetEnd Property#End Region End ClassEnd Namespace
Imports
Namespace
#Region
#End
#Region " Private Fields "
#Region " Public Properties "
<Category(
<Description(
_BusinessObject = value
''' <summary>
_CustomerNameText = value
End
Thanks Greg!