Inability to trap form.show event

  • Thread starter Thread starter Marc the Demi-Programmer
  • Start date Start date
M

Marc the Demi-Programmer

I have a rather simple form that takes a user name and password,
validates it, and loads another form. All this is done in the click
event for the one and only button on the form. Everything works fine
except that after the event is finished the form breaks because of an
unhandled system.argument exception, and highlights the form class
declaration. This only happens when I do the form.show command in the
click event. When I comment it out I do not get the exception. The
strange thing is that I get the exception even when I use a try - catch
block. I know it is the form.show() that is the problem as commenting
that out, regardless of the try-catch block, prevents the exception. If
I can figure out what exactly is causing the exception I could probably
figure this out on my own. I know that the try-catch system is working
as it has caught other problems.

Marc
 
Marc said:
I have a rather simple form that takes a user name and password,
validates it, and loads another form. All this is done in the click
event for the one and only button on the form. Everything works fine
except that after the event is finished the form breaks because of an
unhandled system.argument exception, and highlights the form class
declaration. This only happens when I do the form.show command in the
click event. When I comment it out I do not get the exception. The
strange thing is that I get the exception even when I use a try - catch
block. I know it is the form.show() that is the problem as commenting
that out, regardless of the try-catch block, prevents the exception. If
I can figure out what exactly is causing the exception I could probably
figure this out on my own. I know that the try-catch system is working
as it has caught other problems.

Marc

Something I neglected to mention is that when I step through with the
debugger it seems to process the show() command appropriately. However,
I still get the exception if and only if the show() command is used.

Marc
 
Create two separate new forms, and call one from the other. Then compare why
this one works, and yours doesn't

Jeff
 
It would be helpful if you showed the code and the full text of the
exception including a stack trace. It will be easier to determine what
is happening.
 
Chris said:
It would be helpful if you showed the code and the full text of the
exception including a stack trace. It will be easier to determine what
is happening.

I figured out kind of what was going on. The exception was happening in
a custom control in the form being called. Once I managed to figure out
how to do the debugging in the two projects I managed to fix the issue.

I do appreciate all of your help, not just the person on whose post I am
replying.

Marc
 
Back
Top