Re: Remoting and Events with VB.NET

From: User (google_at_qwirk.net)
Date: 04/07/04


Date: 7 Apr 2004 12:54:21 -0700

Sunny <sunnyask@icebergwireless.com> wrote in message news:<ue08gHyGEHA.684@tk2msftngp13.phx.gbl>...
> Hi k.,
> please read my answer to Kris. When you register the listener with +=
> the object is passed, not an interface, so you still have to have the
> object implementation on both places. If you want to avoid it, use
> wrapper as I described.
>
> Sunny
>

Ok, what I've done now is add two helper classes: EventNotifier and
Eventlistener. Each class that wants to raise events has an
EventNotifier that it registers itself with. Each class that wants to
receive events has an EventListener that is registers itself with.
The Listener registers with the Notifier. When the notifier recieves
an event from the item, it calls the appropiate function on the
listener, who then calls the function on the object it's registered
with.

This seems to work.

The problem is now this: I have a forth project in this solution that
consists of UserControls that i've made: simple extentions of basic
textbox, combobox, dtpicker, etc. with a little more functionallity.
This project is referenced by all other projects in the solution.
These contols work fine usually, even in this application when every
is run without remoting. They work fine even now until they are
called on from the EventListener. What happens is this:

     1. Server loads
     2. Client loads and attaches to server
     3. Client logs in
     4. Client checks out record (say, Employee) from server
     5. EmployeeForm loads and loops through a collection of controls
        (my derived controls) and sets them to readonly/locked mode.
     6. User clicks checkout button
     7. Employee and all child classes are checked out.
           This raises the CheckedOut Event in the Employee and other
classes.
     8. EventListener on the EmployeeForm (actually a UserControl)
loops though
        a Collection of controls and unlocks them.

     Here is where the problem occurs. In my derived Combobox I have
a function isBlank() that checks if the value is = "":
        
     return me.text() = ""
 
     When it hits the me.text the app freezes. CPU time in 0, it's
not nothing is happening. I wrapped it in a try/catch and no
exception is being thrown. It just stops responding (As does the VS
IDE). If I use the Command Window and try to get the value on me.name
I get "error: cannot obtain value" but If I I try to get the value of
m_required (a private boolean) I can get the value. In addition, if I
override the Text property to store the text in a private variable
m_Text and check that for the isBlank function, it works. But when I
try to call a public function/property from within the class, the
whole thing freezes up. All the functionallity works until step 8.
It also works fine when I'm not remoting the Server and just creating
it from the client

     What is going on?

k.