Form.Invoke not calling delegate for some reason

S

SAL

Hello,
I'm developing this remoting app (.net 2.0) and I need to bring the server
app's form to the front often. Since you can not do cross-thread
communication on a form or control without using Invoke, I declared a
delegate to handle the cross-thread call to bring the form forward. Here's
my code:

Delegate Sub BringMeFront()

Public myDelBringFormFront As BringMeFront

In the constructor I set this delegate =
myDelBringFormFront = New BringMeFront(AddressOf BringFormToFront)

BringFormToFront just does a Me.BringToFront but calling it via the delegate
and Invoke should marshal the call on the calling thread.
So, in the function I'm calling from the client I do this:

If Me.InvokeRequired Then
Me.Invoke(myDelBringFormFront)
Else
Me.BringToFront()
End If
The code hits the Me.Invoke(myDelBringFormFront) code but it doesn't
actually call the BringFormToFront code that I pass in when I new the
myDelBringFormFront method. Can anyone tell me why it's not calling the
function?

Any help???
thanks
S
 
S

SAL

Okay,
It is actually stepping into the code but Me.BringToFront is not bringing it
in front of my other form, which is in another process btw. Does
From.BringToFront only bring the form to the front of all other forms in the
current process or is it supposed to bring it in front of all other forms on
the desktop (WinXP sp2 btw)

S
 

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