By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,210 Members | 1,858 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,210 IT Pros & Developers. It's quick & easy.

Strange Windows Form Behavior

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
-----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

P: n/a
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

P: n/a
"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

P: n/a
"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

P: n/a
-----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

P: n/a

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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.