|
-
Oct 24th, 2002, 03:43 PM
#1
Thread Starter
Addicted Member
Events on form unload...?
I only see (Declarations), Finalize, InitializeComponent, and New.
How can I allow something to happen on form close?
Thanks.
-
Oct 24th, 2002, 03:55 PM
#2
Thread Starter
Addicted Member
It works when I use
VB Code:
Private Sub form1_closed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Closed
but isn't there any way that I can just choose it from a list or something? Like in VB6.
I had to copy the form_load thing and change load to closed.
-
Oct 24th, 2002, 04:05 PM
#3
Thread Starter
Addicted Member
What about opening another form when you close the main form?
It was possible using VB6 by just showing a form on form unload. But in VS.Net, when put the code, "f.Show()" and "MsgBox ("what")", the main form was closed, new form opened, but when I closed the msgbox the program closed.
Any help?
-
Oct 24th, 2002, 07:50 PM
#4
If you want a list of form events then you can select (base class events) in the left combo and then the right one will list all the available events.
As for spawning a new form off of the main form, the main thread of your application has to be tied to one form and when that one closes then it will closes all others. You can show a new form modally and that will keep the thread active until the new form is closed.
f.ShowDialog()
-
Oct 25th, 2002, 10:50 AM
#5
Thread Starter
Addicted Member
Originally posted by Edneeis
As for spawning a new form off of the main form, the main thread of your application has to be tied to one form and when that one closes then it will closes all others. You can show a new form modally and that will keep the thread active until the new form is closed.
f.ShowDialog()
I understand the first part but I don't get the second part about keeping the thread active..
Could you explain in more detail?
-
Oct 25th, 2002, 11:04 AM
#6
Well the application has a 'main' thread which is based on the the Sub Main, or first Form. When that item ends it terminates the thread or the application. So you you can't have a form you plan on ending as the main form. Showing a form modally stops the execution of code on the thread until modal form is closed.
-
Oct 25th, 2002, 04:18 PM
#7
Thread Starter
Addicted Member
So.. How would you show a form "modally"?
Thanks.
-
Oct 25th, 2002, 04:21 PM
#8
You use the ShowDialog method instead of the Show method.
f.ShowDialog()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|