472,980 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,980 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 1707
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephen Lamb | last post by:
What type(s) of exceptions will be thrown when calling Form.Invoke when the handle for the form has yet to be created? MS only states, "If no appropriate handle can be found, the Invoke method...
3
by: Brian Keating EI9FXB | last post by:
Hello again, I've already placed a few posts on this topic. This time i've a simple application that exhibits my problem, I've placed sample solution 8k on my website should anyone be interested...
8
by: Brian Keating EI9FXB | last post by:
Would I be correct in saying that the only way to get a user message into a Windows form would be to use P/Invoke with Message? Of is there some part of the .NET API that I am totally un aware...
2
by: Jerry Spence1 | last post by:
One way of passing data to a thread is to encapsulate the thread inside a class. However, I can't refer to my main form objects from within the class/thread as it says "Reference to a non-shared...
7
by: ChrisM | last post by:
Hi, I'm trying to get my head round Async. procedure calls. I have the following code: delegate double GetLabourWIPDelegate(DateTime reqDate); .... GetLabourWIPDelegate...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
3
by: bsturg21 | last post by:
Hello, I have a windows form that has a series of linklabels on it, and I need to have each linklabel, when clicked, open a separate windows form that has a single paramter passed into it. The...
11
by: =?Utf-8?B?QWNoaWxsZXNfX19f?= | last post by:
Im finding problem with this code. When i try to display the newindow, its not responding. It does create the new window, but doesnt respond at all. Just stays blank. I'm fairly new to c#(just a...
3
by: stumorgan | last post by:
Basically what I have is a form with a graph on it which graphs data that I'm reading from a USB device at 100 Hz (every 10ms). I have a thread reading and parsing the data from the USB, but when...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.