Premature Ending of App

  • Thread starter Thread starter Paul Ilacqua
  • Start date Start date
P

Paul Ilacqua

I have a single form VB.NET program that prints some data using
PrintDocument class. The problem is when I preview the document and then
close the preview... it exits the application. I have 2 versions of the
program 1 that exits and 1 that doesn't. I've scoured the properties of the
calling form and sure I can't find where the issue could be.
I appreciate any light someone could shed on where to begin.

Paul
 
Cor,
It's a single form app that contains a Datagrid for display of Data then
the "report Button" builds a string & the report. The odd thing is I have
another version of this that works OK when I close the report preview the
app stays open.
What tells the app to close when a report preview or any other form is
closed?
Thanks for the response.

Paul
 
Paul,

And is the report preview on an other form
(check if that is showed with show or with showdialog on both applications
then)

Cor
 
Cor,
The report buttons call the same class that runs the .ShowDialog(),
that's why it seems to be in the calling form's settings somewhere? Both
form's command buttons are calling the same class in the same way but one
closes the app and 1 doesn't.
The form is pretty complex or I would just recreate it. I'm going to try a
fresh button and see what happens.
 
Cor....
I recreated the calling button and it worked fine.... Now I'll never know
why, but it's fixed. Thanks for your help.....
Paul
 
Paul said:
Cor....
I recreated the calling button and it worked fine.... Now I'll never know
why, but it's fixed. Thanks for your help.....
Paul

Check the Forms AcceptButton and CancelButton properties and also check
the DialogResult property of the button that causes it to close.

Chris
 
Paul said:
Cor....
I recreated the calling button and it worked fine.... Now I'll never know
why, but it's fixed. Thanks for your help.....
Paul

I think a possible reason for this could be:

When you call a form such as Form1.Showdialog, the code is paused from
where it was ran from, eg.

Me.hide()
Form1.Showdialog()
Me.close()

In this code the procedure would be paused at the line of
Form1.Showdialog()

However, the code will be resumed if the instance of Form1 is closed,
so Me.Close will happen, along with the rest of the procedure.
 
Kimera,

I think the most possible problem is as Chris wrote, there has been a bug in
the OK and Cancel button part of the form class. I don't know if it is
already fixed.

Cor
 
Back
Top