Quite confused on classes/usercontrols...

Y

YYZ

I've got a form. On that form, I load in a usercontrol (dynamically,
at run time, depending on if the users wants it or not). The
usercontrol (we'll call it the Search usercontrol) consists of a few
textboxes, and ANOTHER usercontrol (call it the LoanList usercontrol).

The LoanList usercontrol, depending on how many loans were found in the
search, adds in a THIRD type of usercontrol (the LoanSmallSummary
usercontrol). It may have 0 of these, or it may have 100 of these.
I've got all that working.

Now, when the user double clicks on one of the LoanSmallSummary
usercontrols, I want to, from the users' perspective, clear out the
entire search control (and the loanlist and all the loansmallsummary
controls), and dynamically load in the FOURTH type of usercontrol, the
LoanDisplay usercontrol.

With me so far?

I've got all of that working except the double click part. I can
capture a double click on the LoanSmallSummary, but then I'm assuming
I'll have to raise an event to it's parent control, which is the
LoanList usercontrol. Then the LoanList needs to raise an event on the
Search control, then the search control needs to raise an event on the
Form itself, so that form knows to close the search control completely
(but first get the id of the loan that user wants to view), and then
load in the LoanDisplay control.

I can easily add an event to LoanSmallSummary, but how do I cause my
LoanList control to be able to get it? I don't have any hardcoded
names, just an array of type LoanSmallSummary that point to each of the
dynamically loaded LoanSmallSummaries.

Can anyone point me in the right direction?

I'm new to .Net (using version 2003), but not necessarily to OO
programming -- I started out in PowerBuilder.

Thanks for any and all advice.

Matt
 
G

Guest

Adding a new control to the existing UserControl dynamically does not
necessarily mean that it the parent will automatically get events from the
new control. You need to have a valid WithEvents variable assigned to each
new control. Since the controls are dynamic this may be hard to do.
Instead, I would recommend using the VB AddHandler function instead. Call it
for every UserControl you dynamically create.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top