Does not fire CurrentChanged

  • Thread starter Thread starter Domingos Jr.
  • Start date Start date
D

Domingos Jr.

Hello All,

I have a Form with a hierarchical DataSet (2 tables, "Companies",
"Contacts").
When the CurrentChanged event for the bindingcontext of "Companies" changes
I refresh the child DataTable as follows:

dt.Clear()
dt.BeginLoadData()
Dim dr() As DataRow = drv.Row.GetChildRows(dataRelName)
Dim i As Integer
For i = 0 To dr.GetUpperBound(0)
dt.LoadDataRow(dr(i).ItemArray, True)
Next
dt.EndLoadData()

But, since I'm calling "Clear" in the DataTable I no longer receive the
CurrentChanged event for the "Contacts" bindingcontext and this event is
essential for what I am doing.
How can I receive events after clearing the DataTable? Is there a better way
of getting Child Rows in a DataTable replacing the ones that were there
(contacts of another Company, for instance)?

Thanks in advance.

Domingos Jr.
 
Domingos,
How about just clearing out the Table's Rows collection?
e.g. dt.Rows.Clear()

It didn't work! I think that a solution might be to use
RowFilter = "companyId=" & CStr(mainRec("companyId"))

[ ]'s
 
Back
Top