Click here to Skip to main content
15,891,316 members
Home / Discussions / C#
   

C#

 
GeneralRe: Proper way of creating a form with multiple pages Pin
EliottA29-Jun-09 15:51
EliottA29-Jun-09 15:51 
QuestionNeed to search a webpage for a word OR search links in it Pin
p3rson29-Jun-09 12:47
p3rson29-Jun-09 12:47 
AnswerRe: Need to search a webpage for a word OR search links in it Pin
scottgp29-Jun-09 13:38
professionalscottgp29-Jun-09 13:38 
AnswerRe: Need to search a webpage for a word OR search links in it Pin
EliottA29-Jun-09 13:49
EliottA29-Jun-09 13:49 
GeneralRe: Need to search a webpage for a word OR search links in it Pin
p3rson29-Jun-09 22:39
p3rson29-Jun-09 22:39 
GeneralRe: Need to search a webpage for a word OR search links in it Pin
J4amieC29-Jun-09 23:19
J4amieC29-Jun-09 23:19 
GeneralRe: Need to search a webpage for a word OR search links in it Pin
DaveyM6929-Jun-09 23:33
professionalDaveyM6929-Jun-09 23:33 
GeneralRe: Need to search a webpage for a word OR search links in it Pin
EliottA30-Jun-09 2:45
EliottA30-Jun-09 2:45 
AnswerRe: Need to search a webpage for a word OR search links in it Pin
p3rson30-Jun-09 8:53
p3rson30-Jun-09 8:53 
QuestionProblem with reading excel 2007. Pin
hdv21229-Jun-09 12:43
hdv21229-Jun-09 12:43 
QuestionFilter DataTable Pin
skyline9229-Jun-09 12:26
skyline9229-Jun-09 12:26 
AnswerRe: Filter DataTable Pin
Henry Minute29-Jun-09 13:35
Henry Minute29-Jun-09 13:35 
GeneralRe: Filter DataTable [modified] Pin
skyline9230-Jun-09 6:38
skyline9230-Jun-09 6:38 
GeneralRe: Filter DataTable Pin
Henry Minute30-Jun-09 9:59
Henry Minute30-Jun-09 9:59 
GeneralThere is no editor available FOR WAP FORM Make sure the application for the file type (.xaml) Pin
rodbiser29-Jun-09 11:36
rodbiser29-Jun-09 11:36 
GeneralRe: There is no editor available FOR WAP FORM Make sure the application for the file type (.xaml) Pin
donglotus23-Jun-11 6:54
donglotus23-Jun-11 6:54 
QuestionCancelEventArgs - multiple subscribers Pin
DaveyM6929-Jun-09 11:08
professionalDaveyM6929-Jun-09 11:08 
AnswerRe: CancelEventArgs - multiple subscribers [modified] Pin
DaveyM6929-Jun-09 22:20
professionalDaveyM6929-Jun-09 22:20 
QuestionInvalidOperationException - object is currently in use elsewhere - red cross Pin
para para29-Jun-09 10:20
para para29-Jun-09 10:20 
Hello

I have a C# desktop application in which one thread that I create continously gets an image from a

source(it's a digital camera actually) and puts it on a panel(panel.Image = img) in the GUI(which

must be another thread as it is the code-behind of a control.

The application works but on some machines I get the following error at random time

intervals(unpredictable)

<br />
<br />
************** Exception Text **************<br />
System.InvalidOperationException: The object is currently in use elsewhere.<br />
<br />



Then the panel turns into a red cross, red X - i think this is the invalid picture icon that is

editable from the properties. The application keeps working but the panel is never updated

From what I can tell this error comes from the control's onpaint event where I draw something else

on the picture

I tried using a lock there but no luck Frown | :(

The way I call the function that puts the image on the panel is as follows:

<br />
if (this.ReceivedFrame != null)<br />
				{<br />
                    Delegate[] clients = this.ReceivedFrame.GetInvocationList();<br />
                    foreach (Delegate del in clients)<br />
                    {<br />
                        try<br />
                        {<br />
                            del.DynamicInvoke(new object[] { this, new StreamEventArgs(frame) });<br />
                        }<br />
                        catch { }<br />
                    }<br />
                }<br />



this is the delegate:

<br />
public delegate void ReceivedFrameEventHandler(object sender, StreamEventArgs e);<br />
		public event ReceivedFrameEventHandler ReceivedFrame;<br />



and this is how the function inside the control code-behind registers to it:

<br />
Camera.ReceivedFrame += new Camera.ReceivedFrameEventHandler(camera_ReceivedFrame);<br />



I also tried
<br />
del.Method.Invoke(del.Target, new object[] { this, new StreamEventArgs(b) });<br />

instead of
<br />
del.DynamicInvoke(new object[] { this, new StreamEventArgs(frame) });<br />



but no luck


Does anyone know how I could fix this error or at least catch the error somehow and make the thread put the images on the panel once again?

Can anyone help please? I am really stuck
Thank you in advance

hello

AnswerRe: InvalidOperationException - object is currently in use elsewhere - red cross Pin
Christian Graus29-Jun-09 10:44
protectorChristian Graus29-Jun-09 10:44 
GeneralRe: InvalidOperationException - object is currently in use elsewhere - red cross Pin
para para29-Jun-09 10:48
para para29-Jun-09 10:48 
GeneralRe: InvalidOperationException - object is currently in use elsewhere - red cross Pin
Christian Graus29-Jun-09 11:37
protectorChristian Graus29-Jun-09 11:37 
GeneralRe: InvalidOperationException - object is currently in use elsewhere - red cross Pin
para para29-Jun-09 19:14
para para29-Jun-09 19:14 
Questionweb automation using axwebbrowser Pin
T_Teef29-Jun-09 9:59
T_Teef29-Jun-09 9:59 
QuestionI'm needing to have a textbox to be on top of all other controls on the form. Pin
Lecutus129-Jun-09 8:10
Lecutus129-Jun-09 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.