|
-
Jun 23rd, 2003, 12:34 PM
#1
Thread Starter
Frenzied Member
Closing app
I have a MDI app...how do I catch the close event if a user closes a child form by clicking the "X" in the right hand corner? I'd like to get rid of those functions, but when I set to the propery, I lose the form caption...is there a way to get rid of those without losing the caption?
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jun 23rd, 2003, 12:54 PM
#2
Sleep mode
This cancel the event .
VB Code:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = True
End Sub
-
Jun 23rd, 2003, 12:55 PM
#3
Thread Starter
Frenzied Member
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jun 23rd, 2003, 01:02 PM
#4
if you want to give the user a choice of closing the app or not you can do something like this :
VB Code:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MessageBox.Show("Are you sure you want to quit", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
End Sub
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Jun 23rd, 2003, 01:15 PM
#5
Thread Starter
Frenzied Member
got the first part...the next piece of code threw me off?
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Jun 23rd, 2003, 01:48 PM
#6
the bottom bit of code is my signature lol , my wife and i are due to have twins very very soon
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Jun 23rd, 2003, 01:55 PM
#7
Thread Starter
Frenzied Member
congradulations...make sure you get all your sleep in now!
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Dec 3rd, 2003, 01:33 PM
#8
Thread Starter
Frenzied Member
is there a way to detect if the X was clicked. The code below is executed each time the form is closed for any reason, to go to another form, clicking the close button. I need to capture the click event of the X only....any suggestions?
thanks
VB Code:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
-
Dec 3rd, 2003, 02:11 PM
#9
Sleep mode
You need to intercept the message that the form sends to this method and handle it from there . I don't have time to give you a demo but search if you didn't find , let me know .
VB Code:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
End Sub
-
Dec 3rd, 2003, 02:21 PM
#10
Sleep mode
-
Dec 3rd, 2003, 02:42 PM
#11
Thread Starter
Frenzied Member
thanks guys..that worked.
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
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
|