471,066 Members | 1,298 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

Form.Invoke not calling delegate for some reason

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
1 1592
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.

Similar topics

2 posts views Thread by Stephen Lamb | last post: by
3 posts views Thread by Brian Keating EI9FXB | last post: by
8 posts views Thread by Brian Keating EI9FXB | last post: by
7 posts views Thread by ChrisM | last post: by
11 posts views Thread by =?Utf-8?B?QWNoaWxsZXNfX19f?= | last post: by
3 posts views Thread by stumorgan | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.