Forms

  • Thread starter Thread starter Juan Carlos
  • Start date Start date
J

Juan Carlos

Hi

I have this problem, I want to show a form when in my
application happens an exception. I can do this, but I see
the task manager and this form doesn't work it has the
message "Not responding" and If I closed it, all my
application is closed.

But when I use a button to show the form it work fine.

What is wrong???
Regards
 
Juan Carlos said:
I have this problem, I want to show a form when in my
application happens an exception. I can do this, but I see
the task manager and this form doesn't work it has the
message "Not responding" and If I closed it, all my
application is closed.

But when I use a button to show the form it work fine.

What is wrong???

Well, could you post a short but complete example which demonstrates
the problem? See
http://www.pobox.com/~skeet/csharp/complete.html for what I mean by
this.
 
Well this is a short part of my code:

private void Insert() {
try {
OdbcCommand cmm = new OdbcCommand(sql,conn);
int mytest = cmm.ExecuteNonQuery();
}
catch(Exception Ex) {
frmForm myForm = new frmForm();
myForm.Show();
}
}

For example if my connection is closed, will happen an
exception and I will show the form called myForm. But I
look the form in the Task Manager and its status is "Not
responding" and then I try to finalize the form using "End
task" but it close all my application.

myForm hasn't code extra, only the default code writing by
VS.NET

Regards
J.C.
 
* "Juan Carlos said:
I have this problem, I want to show a form when in my
application happens an exception. I can do this, but I see
the task manager and this form doesn't work it has the
message "Not responding" and If I closed it, all my
application is closed.

But when I use a button to show the form it work fine.

Please post the code you use to handle the exception and show the form.
 
Well this is a short part of my code:

private void Insert() {
try {
OdbcCommand cmm = new OdbcCommand(sql,conn);
int mytest = cmm.ExecuteNonQuery();
}
catch(Exception Ex) {
frmForm myForm = new frmForm();
myForm.Show();
}
}

For example if my connection is closed, will happen an
exception and I will show the form called myForm. But I
look the form in the Task Manager and its status is "Not
responding" and then I try to finalize the form using "End
task" but it close all my application.

myForm hasn't code extra, only the default code writing by
VS.NET

Regards
J.C.
 
Juan carlos said:
Well this is a short part of my code:

private void Insert() {
try {
OdbcCommand cmm = new OdbcCommand(sql,conn);
int mytest = cmm.ExecuteNonQuery();
}
catch(Exception Ex) {
frmForm myForm = new frmForm();
myForm.Show();
}
}

For example if my connection is closed, will happen an
exception and I will show the form called myForm. But I
look the form in the Task Manager and its status is "Not
responding" and then I try to finalize the form using "End
task" but it close all my application.

myForm hasn't code extra, only the default code writing by
VS.NET

You haven't shown where the code gets called, or anything like that.
Please give a *complete* sample so we can try to reproduce it without
any mucking around.
 
Back
Top