Basic Question

  • Thread starter Thread starter Sarah
  • Start date Start date
S

Sarah

Hi all,

Just doing my first VB.NET windows app. It has half a
dozen forms and not alot else. When I do a release and
run the exe that has been built (which works fine), I go
to close it by clicking on the X it closes (or appears
to). Infact it is still running in the processes. What
am I doing wrong?
Should there be an application.onclose procedure,
unfortunately I can't find anything on the net and I don't
have any books (i'm flying very blind!).

TIA

Sarah
 
first some questions
1: when you are in debug mode, do you get the same behaviour? (not returning
to the editing mode)
2: how do you call the forms? probably you are leaving some forms open in
the background but its hard to tell like this

eric
 
Sarah said:
Just doing my first VB.NET windows app. It has half a
dozen forms and not alot else. When I do a release and
run the exe that has been built (which works fine), I go
to close it by clicking on the X it closes (or appears
to). Infact it is still running in the processes. What
am I doing wrong?
Should there be an application.onclose procedure,
unfortunately I can't find anything on the net and I don't
have any books (i'm flying very blind!).

Does this also happen in the IDE? If it does, go into pause mode and have a
look at the callstack and the thread window to find out what is going on.
 
Thanks for your replies.

It was doing it in the IDE, and when I did a break it
wasn't in a loop (As i don't have any!) but instantiating
the form. The solution, I found was to put
Application.Exit in each of the form's 'closing' event.

I don't know if this is perfect but it works both in the
IDE and exe.

I was opening forms using the

Dim form as new form2()
form.show()

Code, which is what everybody seems to advise.

Thanks for your help

Regards,

Sarah
 
Sarah said:
Thanks for your replies.

It was doing it in the IDE, and when I did a break it
wasn't in a loop (As i don't have any!) but instantiating
the form. The solution, I found was to put
Application.Exit in each of the form's 'closing' event.

I don't know if this is perfect but it works both in the
IDE and exe.

I was opening forms using the

Dim form as new form2()
form.show()

Code, which is what everybody seems to advise.

Is there one Form that lives from the start til the end of the application?
If there isn't, when do you expect the application to close? When all Forms
have been closed? In this case you have to keep track of all open forms,
handle their closed events and call Application.ExitThread (not
Application.Exit) as soon as the _last_ Form has been closed, not whenever
any Form has been closed.
 
* "Sarah said:
It was doing it in the IDE, and when I did a break it
wasn't in a loop (As i don't have any!) but instantiating
the form. The solution, I found was to put
Application.Exit in each of the form's 'closing' event.

I don't know if this is perfect but it works both in the
IDE and exe.

That's a really brutal way that works.
I was opening forms using the

Dim form as new form2()
form.show()

Code, which is what everybody seems to advise.

That should not be the problem.
 
Back
Top