473,399 Members | 2,478 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,399 software developers and data experts.

Error after a few hours of DoEvents

Hi,

I have an app that often has no windows and uses a NotifyIcon. My Sub Main
has a loop:
Do Until gExit

Application.DoEvents()

Loop

When running the app in development, it works fine. But when running the
exe, DoEvents() raises the following error after several hours:

An unhandled exception of type 'System.ArgumentException' occurred in
mscorlib.dll
Additional information: Item has already been added. Key in dictionary:
"-1" Key being added: "-1"

There's nothing in my app that should happen without human interaction
(clicking, double-clicking the notifyicon, etc). So I'm not sure what's
happening here. The program is basically just sitting there, waiting for
something to happen. I left it running last night and found the error this
morning, so it's not like I'm accidentaly clicking a window or icon and
raising something. I can't find anything in various groups relating to
this. Anyone have any thoughts?

Thanks,

Jeff
Nov 20 '05 #1
2 939
"Jeff Cooper" <js******@compudude.com> schrieb
Hi,

I have an app that often has no windows and uses a NotifyIcon. My
Sub Main has a loop:
Do Until gExit

Application.DoEvents()

Loop


Replace the whole loop by

Application.run

Otherwise you get 100% CPU usage. Instead of setting gExit, call
application.ExitThread. If this doesn't fix the problem, find out the error
line and post it here.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
I'm having the same problem - my loop's almost identical - help us please!

James

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 20 '05 #3

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

Similar topics

2
by: Colin Leahey | last post by:
Hi, I 'm using oleBlob.Action = acOLEInsertObjDlg to insert OLE objects into a database but when this line is executed I get error 2793 'E & S Database can't perform the operation specified in the...
7
by: Ottar | last post by:
I've made a program sorting incomming mail in public folder. The function runs every minute by using the form.timer event. In Access XP it runs for weeks, no problem. Access 2003 runs the same...
5
by: Srinivas Kollipara | last post by:
Hey guys, In my project one place I am using Application.DoEvents() and waiting for 5 minutes to finish my required task in that block. My project need to run for almost 60 hours continuously to...
2
by: DenoxiS | last post by:
Hi, I'm having problem with this internet application. It's a simple form with a button and couple text boxes where I can enter parameters like timeout etc. Once I push the button, it starts...
8
by: jcrouse | last post by:
I am using the following code to trap errors in a sub routine: Try Executable code Catch ex As Exception Dim strInputE As String = Application.StartupPath & "\Error.txt" Dim srE As...
7
by: ddd | last post by:
Hi, I am having problems with using the DrawToDC of the MSHTML.iHTMLElementRender in a VB.net application. For some reason I am getting a "catastrophic error". I am basing the code on c#...
0
by: Ralf Gedrat | last post by:
Hello! I have a Application, this throws after some time following exception: Item has already been added. Key in dictionary: "- 1" key being added: "- 1" I use Application.Run with...
25
by: MLH | last post by:
Is it a common occurrence for A97 VBA to 'RACE' on past a debug.print statement? I have been trying to debug a problem (which turned out to be an attempt to assign Null to a Date Type variable)...
0
by: =?Utf-8?B?REx1ZWNr?= | last post by:
I am getting a debug assertion error that reads: Debug Assertion Failed! program E:\program files\internet explorer\iexplore,exe File: dbgheap.c Line: 1252 Expression:...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.