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

Strange Windows Form Behavior

Hello,

I have a strange problem that occurs every so often in my
application. It usually takes place when I hide one form
and activate another. What happens is I get the
following exception:

System.ArgumentException occured in
System.Windows.Forms.dll

Additional Information: Invalid Parameter Used.

This occurs sporatically and I haven't found a way yet to
reproduce it reliably. However I just had it occur while
in the debugger and observed some interesting facts:

1. When the debugger stops and highlights the line of
code that the error occured, it is always on the line
where the form is declared and the name of the form
itself is highlighted. For instance, in:

Friend Class Form1

Form1 would be highlighed green by the debugger.

2. It always happens to my startup form (I don't use a
Sub Main). I've tried switching the startup form and the
problems still occurs on the new startup form.

Any ideas or suggestions would be greatly appreciated.

Cheers,
Tyler Foreman


Nov 20 '05 #1
7 2610
-----Original Message-----
"Tyler Foreman" <ty***********@icommm.com> schrieb
I have a strange problem that occurs every so often in my application. It usually takes place when I hide one form and activate another. What happens is I get the
following exception:

System.ArgumentException occured in
System.Windows.Forms.dll

Additional Information: Invalid Parameter Used.

This occurs sporatically and I haven't found a way yet to reproduce it reliably. However I just had it occur while in the debugger and observed some interesting facts:

1. When the debugger stops and highlights the line of
code that the error occured, it is always on the line
where the form is declared and the name of the form
itself is highlighted. For instance, in:

Friend Class Form1

Form1 would be highlighed green by the debugger.

2. It always happens to my startup form (I don't use a
Sub Main). I've tried switching the startup form and the problems still occurs on the new startup form.

Any ideas or suggestions would be greatly appreciated.

What does the callstack show when the error occurs?
--
Armin

.


Hi,

The callstack shows the following:

<Non-user Code>
Myapp.exe!Myapp.Form1.Main() Line 6 + 0x1d bytes

Also, I seem to be able to make it occur more frequently
in the IDE when I set a breakpoint in one of my
subforms. When I open the subform then close it and
reactivate the main form (Form1), I can get the error to
occur pretty consistently. It seems very strange to me.

Tyler
Nov 20 '05 #2
Hi,
Do U have any code in load or activate events? If yes
check if the code has any problem or any activated object
in these events.
Or the probablity may be, if ur form object is accessing
any other object from DLL, and if that object is
throwing "NULLReferenceException", U will C such errors on
form activate

Mahesh
-----Original Message-----
Hello,

I have a strange problem that occurs every so often in my
application. It usually takes place when I hide one form
and activate another. What happens is I get the
following exception:

System.ArgumentException occured in
System.Windows.Forms.dll

Additional Information: Invalid Parameter Used.

This occurs sporatically and I haven't found a way yet to
reproduce it reliably. However I just had it occur while
in the debugger and observed some interesting facts:

1. When the debugger stops and highlights the line of
code that the error occured, it is always on the line
where the form is declared and the name of the form
itself is highlighted. For instance, in:

Friend Class Form1

Form1 would be highlighed green by the debugger.

2. It always happens to my startup form (I don't use a
Sub Main). I've tried switching the startup form and the
problems still occurs on the new startup form.

Any ideas or suggestions would be greatly appreciated.

Cheers,
Tyler Foreman


.

Nov 20 '05 #3
"Tyler Foreman" <ty***********@icommm.com> schrieb
What does the callstack show when the error occurs?


The callstack shows the following:

<Non-user Code>
Myapp.exe!Myapp.Form1.Main() Line 6 + 0x1d bytes

Also, I seem to be able to make it occur more frequently
in the IDE when I set a breakpoint in one of my
subforms. When I open the subform then close it and
reactivate the main form (Form1), I can get the error to
occur pretty consistently. It seems very strange to me.


Could you please expand the <Non-user Code>? There's an option when
right-clicking in the callstack window.
--
Armin

Nov 20 '05 #4
"Tyler Foreman" <ty***********@icommm.com> wrote in news:0fce01c378b3
$e****************@phx.gbl:

Friend Class Form1


Lonshot: What is the name of your form instance and what is the name of
your form class? Are they the same? If so, could that be contributing to
the problem?

Chris
Nov 20 '05 #5
-----Original Message-----
"Tyler Foreman" <ty***********@icommm.com> schrieb
>What does the callstack show when the error occurs?
The callstack shows the following:

<Non-user Code>
Myapp.exe!Myapp.Form1.Main() Line 6 + 0x1d bytes

Also, I seem to be able to make it occur more frequently in the IDE when I set a breakpoint in one of my
subforms. When I open the subform then close it and
reactivate the main form (Form1), I can get the error to occur pretty consistently. It seems very strange to

me.
Could you please expand the <Non-user Code>? There's an option whenright-clicking in the callstack window.
--
Armin

.

Hi,

Thanks for your response. Here is the expanded non-user
code:

system.windows.forms.dll!
System.Windows.Forms.Control.PaintWithErrorHandlin g
(System.Windows.Forms.PaintEventArgs e = {ClipRectangle=
{X=0 Y=0 Width=316 Height=236}}, short layer = 2, bool
disposeEventArgs = false) + 0xee bytes

system.windows.forms.dll!
System.Windows.Forms.Control.WmPaint
(System.Windows.Forms.Message m =
{System.Windows.Forms.Message}) + 0x2ff bytes

system.windows.forms.dll!
System.Windows.Forms.Control.WndProc
(System.Windows.Forms.Message m =
{System.Windows.Forms.Message}) + 0x2d6 bytes

system.windows.forms.dll!ControlNativeWindow.OnMes sage
(System.Windows.Forms.Message m =
{System.Windows.Forms.Message}) + 0x13 bytes

system.windows.forms.dll!ControlNativeWindow.WndPr oc
(System.Windows.Forms.Message m =
{System.Windows.Forms.Message}) + 0xda bytes

system.windows.forms.dll!
System.Windows.Forms.NativeWindow.DebuggableCallba ck(int
hWnd = 264694, int msg = 15, int wparam = 0, int lparam =
0) + 0x3d bytes

system.windows.forms.dll!
System.Windows.Forms.Application.ComponentManager. System.W
indows.Forms.UnsafeNativeMethods+IMsoComponentMana ger.FPus
hMessageLoop(int dwComponentID = 1, int reason = -1, int
pvLoopData = 0) + 0x349 bytes

system.windows.forms.dll!ThreadContext.RunMessageL oopInner
(int reason = -1, System.Windows.Forms.ApplicationContext
context = {System.Windows.Forms.ApplicationContext}) +
0x1f3 bytes

system.windows.forms.dll!ThreadContext.RunMessageL oop(int
reason = -1, System.Windows.Forms.ApplicationContext
context = {System.Windows.Forms.ApplicationContext}) +
0x50 bytes

system.windows.forms.dll!
System.Windows.Forms.Application.Run
(System.Windows.Forms.Form mainForm = {MYAPP.Form1}) +
0x34 bytes

MYAPP.exe!MYAPP.Form1.Main() Line 6 + 0x1d bytes Basic

Sorry that it is so unreadable, but this textbox doesn't
offer much in the way of formatting.

Thanks,
Tyler Foreman

Nov 20 '05 #6

Hi,

I do have code for my form load event, but this problem
occurs long after the form is loaded. I did not have any
code to handle the form activate event, but I put some in
to see if I could capture the problem there. No luck.
As far as the dll, I do have several OCX controls and
DLLs. However, I've tried running the same scenario with
a simple splash form as my startup form and the error
still occured on that form which had no controls on it.
So I'm not sure if its related to any DLLs. Do you have
any suggestions on how I might verify this?

Thanks,
Tyler Foreman
-----Original Message-----
Hi,
Do U have any code in load or activate events? If yes
check if the code has any problem or any activated objectin these events.
Or the probablity may be, if ur form object is accessing
any other object from DLL, and if that object is
throwing "NULLReferenceException", U will C such errors onform activate

Mahesh
-----Original Message-----
Hello,

I have a strange problem that occurs every so often in myapplication. It usually takes place when I hide one formand activate another. What happens is I get the
following exception:

System.ArgumentException occured in
System.Windows.Forms.dll

Additional Information: Invalid Parameter Used.

This occurs sporatically and I haven't found a way yet toreproduce it reliably. However I just had it occur whilein the debugger and observed some interesting facts:

1. When the debugger stops and highlights the line of
code that the error occured, it is always on the line
where the form is declared and the name of the form
itself is highlighted. For instance, in:

Friend Class Form1

Form1 would be highlighed green by the debugger.

2. It always happens to my startup form (I don't use a
Sub Main). I've tried switching the startup form and theproblems still occurs on the new startup form.

Any ideas or suggestions would be greatly appreciated.

Cheers,
Tyler Foreman


.

.

Nov 20 '05 #7
"Tyler Foreman" <ty***********@icommm.com> schrieb
-----Original Message-----
"Tyler Foreman" <ty***********@icommm.com> schrieb
>What does the callstack show when the error occurs?

The callstack shows the following:

<Non-user Code>
Myapp.exe!Myapp.Form1.Main() Line 6 + 0x1d bytes

Also, I seem to be able to make it occur more frequently in the IDE when I set a breakpoint in one of my
subforms. When I open the subform then close it and
reactivate the main form (Form1), I can get the error to occur pretty consistently. It seems very strange to

me.

Could you please expand the <Non-user Code>? There's an

option when
right-clicking in the callstack window.


Thanks for your response. Here is the expanded non-user
code:

[callstack]


Hmm.... one of those I'd-have-to-sit-in-front-of-your-PC-to-find-the-error
situations. ;-)

Seriously, I've no clue at the moment. Anybody else? ... Do you use
multiple threads? You wrote, you changed the startup form, despite the error
occurs, right? Even if the Form is empty? Which controls are on your actual
startup form? Is there the possibility to reduce the project step by step to
narrow the problem down to as few LOCs as possible?
--
Armin

Nov 20 '05 #8

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

Similar topics

0
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set...
0
by: Richard Hollenbeck | last post by:
I've asked this question before but over a month later I still don't have an answer. A few people did try to help and I am thankful, but I really didn't get the problem solved. I'll try to ask...
6
by: Sam Sungshik Kong | last post by:
Hello! I'm testing Graphics.DrawString and it's very strange. I created an event handler for the form.s Paint event. (There's no other code in the form.) private void Form1_Paint(object...
1
by: Justice Gray | last post by:
I have the following code encapsulated in an ascx page (user control): namespace MyCompany.Web.UserControls { string webform_namespace = this.GetType().Namespace.ToString(); } Now, when I...
5
by: Lucvdv | last post by:
Can anyone explain why this happens with the code at the bottom? It looked like a thread safety issue, but changing the declaration of Label1 to Shared doesn't help. Standard windows form;...
1
by: hansolox1 | last post by:
The following program simply sets the icon of a form called form1. When I get the name of the embedded icon using GetManifestResourceNames(), I store the name in a string variable called s. The...
6
by: Joseph Geretz | last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm adding matching pairs of Toolbar buttons and Menu items. All of the buttons and menu items are wired up to send events to...
3
by: senfo | last post by:
I developed a Windows control in VS 2005 that inherits from the PictureBox Control that adds the ability to select images in a Windows application. It is, however, experiencing a strange issue...
3
by: TC | last post by:
I have a form which I'd like to display as a sizable dialog box. The behavior I get when I use FormBorderStyle = SizableToolWindow is perfect. However, when I use that option, the title bar of my...
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
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...
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
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...

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.