Hi Otis,
I have a binding issue that I need assistance with - typically with combo boxes. I've tested the issue with a standard VS2005 ComboBox and Janus ComboBox and they both exhibit the same problem so I'm hoping your deeper experience can shed some light on the problem.
The form in question contains a large number of controls - Janus textboxes, comboboxs, grids and tabs etc. and is used to display member information.
The form is instantiated using:
Dim newForm as New MemberDataForm
newForm.Open(entityId)
The form's Open methods are:
Public Overrides Sub Open(Byval entityId as System.Guid)
' GetMember returns a Member Entity object for a given entityId.
Me.Open(MemberData.GetMember(entityId, True))
End Sub
Public Overrides Sub Open(Byval entityObject as EntityBase2)
' Sets up data binding using a call to a BindField method in the base form using
' BindField(control?, BindableValue?, DataField?) format.
' ... and is repeated for each bound field on the form.
End Sub
The New constructor of the form initialises icons from the resource file and populates the 'to be bound' combo box called cboStatus thus:
With cboStaus
.ValueMember = "LookupValue"
.DisplayMember = "LookupValue"
.DataSource = LookupData.GetLookupList("MEMBERSTATUS")
.SeletedValue = ""
End With
Ok, when the application is run and this Member form is initialised and passed an entityId, the member entity is retrieved fine and after the binding operation completes and the form is displayed there is no value shown in the cboStatus combo box. The combo box when dropped down contains the correct lookup list values.
Bare in mind that all these binding operations are called prior to showing the form.
When I place a me.show before the first binding operation all of the fields and combo boxes show the right values. With the me.show after the binding operations, the combobox value is blank.
During my stepping through the code I observed that two properties of the cboStatus combobox - namely cboStatus.DataBindings(0).IsBinding and cboStatus.DataBindings(0).BindingManagerBase - have different values.
When it binds correctly and shows the value, these properties contain True and System.Windows.Forms.PropertyManager respectively. When they don't bind correctly, they contain False and Nothing respectively.
Any advice would be very much appreciated
Thanks in advance
Neil