473,387 Members | 1,504 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,387 software developers and data experts.

"Red Cross" - The object is currently in use elsewhere

Hello,

I have a C# Windows Forms application for machine. Due to some unknown
reasons, the application face problems with unexpected exceptions happening,
resulting in two red lines forming a red cross across a certain
control (the entire form, labels and so on). I get the following message in
MessageBox.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidOperationException: The object is currently in use elsewhere.
at System.Drawing.Graphics.EndContainer(GraphicsConta iner container)
at
System.Windows.Forms.DibGraphicsBufferManager.Rele aseBuffer(GraphicsBuffer
buffer)
at System.Windows.Forms.GraphicsBuffer.Dispose()
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Label.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)


The machine is used to handle Microchip Test. When running in production, it
will update the output quantity on the Forms. When the "Red Cross" appears,
the application will hang but machine still keep running. All the data that
generate after that will be lost. This issue is very serious. All my customer
complaining on this issue.
Anyone has the solution? Please reply me as soon as possible. Thanks.
Apr 12 '06 #1
4 7761
Mau Kae Horng,

So you use different threads to draw on the control/form at the same time?

--

Stoitcho Goutsev (100)

"Mau Kae Horng" <Mau Kae Ho***@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
Hello,

I have a C# Windows Forms application for machine. Due to some unknown
reasons, the application face problems with unexpected exceptions
happening,
resulting in two red lines forming a red cross across a certain
control (the entire form, labels and so on). I get the following message
in
MessageBox.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidOperationException: The object is currently in use
elsewhere.
at System.Drawing.Graphics.EndContainer(GraphicsConta iner container)
at
System.Windows.Forms.DibGraphicsBufferManager.Rele aseBuffer(GraphicsBuffer
buffer)
at System.Windows.Forms.GraphicsBuffer.Dispose()
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Label.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)


The machine is used to handle Microchip Test. When running in production,
it
will update the output quantity on the Forms. When the "Red Cross"
appears,
the application will hang but machine still keep running. All the data
that
generate after that will be lost. This issue is very serious. All my
customer
complaining on this issue.
Anyone has the solution? Please reply me as soon as possible. Thanks.

Apr 12 '06 #2
On Wed, 12 Apr 2006 04:01:01 -0700, Mau Kae Horng wrote:
I have a C# Windows Forms application for machine. Due to some unknown
reasons, the application face problems with unexpected exceptions happening,
resulting in two red lines forming a red cross across a certain
control (the entire form, labels and so on). I get the following message in
MessageBox.


You have Red Cross virus.
Apr 12 '06 #3
Actually, I am using multithreading in the application. The threads will set
the Event to let the application to do the data updates on the form. In other
words, the form will updates in every 100ms depending on the event set by
other threads.

Beside, all the control I am using is User Control. I inherit the
System.Windows.Forms.Control to create my own control. I also override
On_Paint() function to draw my own style for the control. Will this affected?


"Stoitcho Goutsev (100)" wrote:
Mau Kae Horng,

So you use different threads to draw on the control/form at the same time?

--

Stoitcho Goutsev (100)


Apr 13 '06 #4
Mau Kae Horng,

All the updates thad you do to the UI has to be done by the UI thread (the
thread that runs the message pump and has created the controls). If you try
to update the UI from a working thread many bad things can happen including
the error that you get. Marshaling the call is done via Control.Invoke or
Control.BeginInvoke methods.

This question has been asked milons of times; just google for Control.Invoke
and Control.InvokeRequired to find out how to do it.
--
HTH
Stoitcho Goutsev (100)

"Mau Kae Horng" <Ma*********@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...
Actually, I am using multithreading in the application. The threads will
set
the Event to let the application to do the data updates on the form. In
other
words, the form will updates in every 100ms depending on the event set by
other threads.

Beside, all the control I am using is User Control. I inherit the
System.Windows.Forms.Control to create my own control. I also override
On_Paint() function to draw my own style for the control. Will this
affected?


"Stoitcho Goutsev (100)" wrote:
Mau Kae Horng,

So you use different threads to draw on the control/form at the same
time?

--

Stoitcho Goutsev (100)

Apr 13 '06 #5

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

Similar topics

4
by: John Benson | last post by:
Hi, I'm using Tkinter and would like to know how to replace the red "Tk" logo in the left corner of the title bar of the root window with some other icon. Another question for curiosity's sake:...
0
by: Walter Quirtmair | last post by:
Hello, I have a C# WinForms Application that contains various "old" ActiveX-Controls. Due to some unknown reasons recently the "red cross" - problems appears quite often. Without any know...
4
by: J Fisk | last post by:
Hi, I've been banging my head on the wall over this for about two days now so any thoughts are much appreciated. I have a static .svg file with embedded onclick="open()"'s all over. The svg...
4
by: RSH | last post by:
I am trying to figure out how I can trap the Closing Event that occurs when a user attempts to close the window by clicking on the red"X". I tried this code which I found online but nothing...
8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
3
by: Pieter Coucke | last post by:
Hi, In my VB.NET 2005 application I'm generating and sending emails using the outlook-object model (2003). When a mail is Send (MailObject_Send), I raise an event in a global class, that is...
5
by: Rob R. Ainscough | last post by:
I'm using a BackgroundWorker to perform a file download from an ftp site. Per good code design practices where I separate my UI code from my core logic code (in this case my Download file method in...
11
by: taoberly | last post by:
A few months ago I posted a question about using a file on my hard drive to perform cross-frame scripting and pull data from a server on my company's intranet. I eventually got this working using...
11
by: Ahmedhussain | last post by:
hey everyone... I have a code which gives me this error. Error : Cross-thread operation not valid: Control 'textBox1' accessed from a thread other than the thread it was created on. I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.