Clearing textbox on add when bindings set dynamically


Author
Message
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Ill check out that collection. The example does a text box (txtValue), I cut out other code for readability that does much of the same.

Keith Chisarik
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The refreshing of controls works on a list of bound controls for a BO, accessed via the BoundControls property. This should be set when you set the BusinessObject property of a control that implements IBusinessBindable (if it was implemented correctly). This is what is happening with a normal SF textbox. The first thing I'd check, via a break point, is if the controls are in fact getting added to the BoundControls list, and I'd check that the list isn't some getting cleared before you use it.



As I look at your code, I'm wondering if you are setting up all the controls you need to. It appears that you are only setting up controls that are SDSI_cmdDataButton types. Does this type include controls you might need like textboxes and combos (two very common bound controls)? You need to set the BusinessObject property of the control to get it added to the BoundControls collection.
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
I have a form that serves as a single maintenance form for many very simple BO's. The user selects the table they want to maintain and the control bindings are created, all works fine but the textboxes would NOT clear upon a call to the forms add method. Eveything else worked fine. I added an event handler to manually clear it but I am wondering why I had to do that and if anything is "wrong" since it didnt work as expected. Any ideas?

Binding Code Snippet:

Dim strBOname As String = cboTables.SelectedValue

Dim typeRef As Type

typeRef = MicroFour.StrataFrame.Tools.Common.GetTypeFromReferencedAssemblies(strBOname)

boMaintenance = CType(Activator.CreateInstance(typeRef), BusinessLayer)

boMaintenance.ParentContainer = Me

boMaintenance.SynchronizingObject = Me

Me.BusinessObjects.Add(boMaintenance)

txtValue.BusinessObject = boMaintenance

txtValue.BindingField = boMaintenance.AllFieldsList.Find(AddressOf findBindingValue)

txtValue.Refresh()

Dim boCastToParent As Object

boCastToParent = CType(boMaintenance, RTIC.BUSINESS.SQLBASEBO)

boCastToParent.FillByTableName(cboTables.Text)

boMaintenance.CopyDataFrom(boCastToParent, BusinessCloneDataType.ClearAndFillFromDefaultView)

boMaintenance.Filter = boMaintenance.AllFieldsList.Find(AddressOf findPKField) & " >= 10"

boMaintenance.SetDirtyOnEdit = True

Me.PrimaryBusinessObject = boMaintenance

For Each Control In Me.pnlAllControls.Controls

If TypeOf (Control) Is UI.SDSI_cmdDataButton Then

CType(Control, UI.SDSI_cmdDataButton).BusinessObject = Me.PrimaryBusinessObject

End If

Next

boMaintenance.Navigate(BusinessNavigationDirection.First)

Me.pnlAllControls.Visible = True

updateButtonState()

Me.cboTables.Visible = False

Me.lblSelection.Visible = False

Me.RefreshBusinessObjects()

Me.Refresh()

AddHandler boMaintenance.EditingStateChanged, AddressOf ClearTextBox



Keith Chisarik
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search