Greg,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
Thanks Greg!