Hi,
Try something like this. It will loop through the controls
added to the panel and allow you to change the datasource of the user
control.
For each ctrl as control in ddMainLookup.controls
if typeof ctrl is uscTWExpenses then
with DirectCast(ctrl, uscTWExpenses)
.datasource =
gdsTrialWorks.Tables("twExpense").Select("CaseId = " &
glngtwCaseID)
.Refetch()
end if
next
Ken
--------------------
Ken
Here is what happens when the user control is loaded
If glngtwCaseID = 0 Then
.DataSource = Nothing
Else
.DataSource = gdsTrialWorks.Tables("twExpense").Select("CaseId = " &
glngtwCaseID)
.Refetch()
End If
I declared glngtwCaseID as public so it can be seen from frmDesktop parent
from and set from it too. Again, I need some code that I can run from the
parent where I can instruct the loaded usercontrol to refetch the data,
filter it or reselect which eliminates reloading the entire control in the
code I sent previously. I used to be able to control such things in MS
Access when I declare the object. My real problem is trying to control the
loaded user control from the parent. The panel is a placeholder, which is
used to load various user controls and that's why I have to get past this
first problem.
> Hi,
>
> I dont see where you add data to puscTWExpenses maybe you could
post
> the code for that. Really dont see why you have to clear the control and
> readd it.
[quoted text clipped - 4 lines]
> need to instruct the object (child), which is the usercontrol that I've
> loaded into the panel in the parent form to refresh its data, or move to
the
> next record, by virtue of a filter. So what code would I use to tell the
> usercontrol to do something. Let's look at the details...
[quoted text clipped - 21 lines]
>
> Private Sub ddlMainLookup_SelectedValueChanged(ByVal sender As Object,
ByVal
> e As System.EventArgs) Handles ddlMainLookup.SelectedValueChanged
> Me.panDesktop.Controls.Clear()
[quoted text clipped - 7 lines]
> As you can see, I'm having to clear the panel and reload it, which happens
> to yeild the results I need. But this is rather slow and clumsy. I need
to
> be able to invoke a method that tell puscTWExpenses to refresh/requery
it's
> data so it will show me the returns for matching header data in the parent
> form which lives in panDesktop.
[quoted text clipped - 6 lines]
> >
> > Maybe you can use databinding
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/v
bnet02122002.asp
> > Ken
> > --------------------
[quoted text clipped - 11 lines]
> > REFETCH, of figure out a way to tell the underlying UserControl object
> > living in the panel to update whenever the parent record/combobox
changes.
> > Please help.
> >
> > John
John,
I think your best bet would be to use a DataView instead of a .Select() as
your DataSource. Then it's a simple matter of changing the RowFilter in your
SelectedValueChanged() event.
~~Bonnie
> Ken;
>
[quoted text clipped - 100 lines]
> > >
> > > John