Sorry Cor,
You're right. For the sake of discussion, let's say the first parameter is
"Text".
As for the different behavior, well, once Beth enlightened me on the
"different path, different currency manager" thing, it became... well not
CLEAR, but not completely opaque either.
I will try to distill my problem. The following code throws no exceptions;
mds.Tables(0).Rows.Count <> 0, yet CMA.Count=0. How can I change the order
of execution or the definition of CMA to ensure that
CMA.Count=mds.Tables(0).Rows.Count?
Private mds As DataSet
Private CMA as CurrencyManager
Protected Overrides Sub OnParentRowChanged()
Dim entID As Long
Dim entType As Integer
Dim b As Binding
Dim blnReBind As Boolean = False
Dim strBind As String = ""
Select Case MyBase.ParentRow.GetType.Name
Case "tblItemRow"
mds = global.dsItemContext1
entID = ParentRow("ItemID")
entType = 1
If Not CMA Is Nothing Then
If Not CType(CMA.Current, DataRowView).Row.GetType.Name
= "tblItemRow" Then
blnReBind = True
End If
Else
blnReBind = True
End If
strBind = "tblItem.tblItem"
Case "tblSystemRow"
mds = global.dsSystemContext1
entID = ParentRow("SystemID")
entType = 0
If Not CMA Is Nothing Then
If Not CType(CMA.Current, DataRowView).Row.GetType.Name
= "tblSystemRow" Then
blnReBind = True
End If
Else
blnReBind = True
End If
strBind = "tblSystem.tblSystem"
End Select
mds.Tables("tblMaintenanceScheduleDetail").Clear()
mds.Tables("tblMaintenanceSchedule").Clear()
If blnReBind Then
Me.combo0.DataBindings.Clear()
Me.combo0.DataBindings.Add(New Binding("SelectedValue", mds,
strBind & "tblMaintenanceSchedule.Activity"))
b = New Binding("CheckState", mds, strBind &
"tblMaintenanceSchedule.WarrantyRequirement")
AddHandler b.Format, AddressOf BooleanToCheckState
AddHandler b.Parse, AddressOf CheckStateToBoolean
Me.chk0.DataBindings.Clear()
Me.chk0.DataBindings.Add(b)
CMA = DirectCast(Me.BindingContext(mds, strBind &
"tblMaintenanceSchedule"), CurrencyManager)
blnReBind = False
End If
LoadData(entID, entType)
SourceListBox(entID, entType)
End Sub
Protected Overloads Sub LoadData(ByVal entityID As Long, ByVal
entityType As Integer)
Dim dsTemp As New DataSet
dsTemp.Merge(global.DAC.GetMaintenanceSchedules(, entityType,
entityID))
If Not dsTemp.Tables(0).Rows.Count = 0 Then
mds.Merge(dsTemp)
End If
End Sub