473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Questions about Form.Invoke and Form.BeginInvoke

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 will throw an exception.
Exceptions that are raised during the call will be propagated back to the
caller."
http://msdn.microsoft.com/library/de...voketopic1.asp

How is a programmer to know if the exception thrown was from running the
delegate or from not having a valid window handle?

Calling Form.Invoke also throws an exception if the form has been disposed.

Why did MS not specify the types of exceptions thrown? They seem to specify
it in all the other cases that I've seen. Are there other cases where they
just state that an exception will be thrown without saying of what type(s)?
Is there any guarantee that if Form.BeginInvoke is called twice from the
same thread on the same form, that the first delegate passed to BeginInvoke
will run first? The docs don't mention this case at all.

Nov 16 '05 #1
2 5477
If you call Invoke before Form is being shown or after it is disposed a
System.InvalidOperationException is thrown with Message "Cannot call
Invoke or InvokeAsync on a control until the window handle has been
created"

Maqsood Ahmed
Kolachi Advanced Technologies

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #2
"Maqsood Ahmed" <ma***********@gawab.com> wrote in message
news:uP*************@tk2msftngp13.phx.gbl...
If you call Invoke before Form is being shown or after it is disposed a
System.InvalidOperationException is thrown with Message "Cannot call
Invoke or InvokeAsync on a control until the window handle has been
created"

Thanks for the info. I know that I've gotten at least two differnet
exceptions thrown from calling Invoke.

The problem is that MS does not state what type(s) will be throw. I was
hoping someone might know of some web page where MS actually states the
types or if MS is trying to resolve this issue or if this is a well known
problem with no solution, etc.

What I don't want to do is to rely on experimentation to figure out the
types. If MS doesn't state the types, they can throw whatever types they
want. So on Tuesday, if it is raining in Florida, MS will throw the
EatYourPeasException.
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: boxim | last post by:
hi all, I'm having a few problems whereby my application is hanging when using the Invoke method of a form's control. Basically, when a user clicks a button on the form, it calls a remote...
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...
6
by: Valerie Hough | last post by:
I'm not entirely sure what the difference is between these two approaches. In order to avoid reentrant code, I was using Control.BeginInvoke in my UI to cause an asynchronous activity to be done...
2
by: Sid Price | last post by:
Hello, I am having a problem with a windows form when controlling its visibility. My application has a form that displays a timing function. Normally the timing form is hidden. An object has a...
5
by: Jerry Spence1 | last post by:
I have the following which generates MDI forms, but doesn't show them at this stage: For n As Integer = 1 To 10 fmViewer(n) = New frmViewer fmViewer(n).Tag = n fmViewer(n).MdiParent =...
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...
4
by: Bill McCormick | last post by:
Hello, A timer control (I think) runs in another thread apart from a main form. In the OnTick event, you can update some form control with no worries. I'm making an AsyncronousServer class...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.