473,221 Members | 1,549 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,221 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 2602
-----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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.