By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,220 Members | 1,473 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,220 IT Pros & Developers. It's quick & easy.

Form.Invoke not calling delegate for some reason

P: n/a
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
Feb 23 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

"SAL" <SA**@NoNo.comwrote in message
news:ez**************@TK2MSFTNGP03.phx.gbl...
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

Feb 23 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.