473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Owner Form issue

VJ
I have the following code when I am showing a form...

Form1's

Private Sub btn1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles btn1.Click

Form2 = new Form2()
Form2.Owner = Me
Form2.Show()

End Sub
In that Form2s close event.. I have code to show a message box when they
close without saving...

Public Form2_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If FileNotSaved() Then
MessageBox("Do you wish to save?", MsgBoxStyle.Exclamation +
MsgBoxStyle.YesNo, "Test")
End Sub
End Sub

Now if I close the Form1. The Form2's close event does not fire, What
different should I do?

Thanks
VJ
Nov 20 '05 #1
2 1373
Try to put the
Form2 = new Form2()
in a module
and skip the
Form2.Owner = Me

/Jens
"VJ" <vi********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have the following code when I am showing a form...

Form1's

Private Sub btn1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn1.Click

Form2 = new Form2()
Form2.Owner = Me
Form2.Show()

End Sub
In that Form2s close event.. I have code to show a message box when they
close without saving...

Public Form2_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If FileNotSaved() Then
MessageBox("Do you wish to save?", MsgBoxStyle.Exclamation +
MsgBoxStyle.YesNo, "Test")
End Sub
End Sub

Now if I close the Form1. The Form2's close event does not fire, What
different should I do?

Thanks
VJ

Nov 20 '05 #2
VJ
I Initially had that.. it did not work.. then I changed to this thinking it
might work..., it is like "aah I am smarter".. you know what I mean,... :-)

VJ

"Jens Blom" <bl******************@hotmail.com> wrote in message
news:OC**************@TK2MSFTNGP10.phx.gbl...
Try to put the
Form2 = new Form2()
in a module
and skip the
Form2.Owner = Me

/Jens
"VJ" <vi********@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I have the following code when I am showing a form...

Form1's

Private Sub btn1_Click(ByVal sender As Object, ByVal e As

System.EventArgs)
Handles btn1.Click

Form2 = new Form2()
Form2.Owner = Me
Form2.Show()

End Sub
In that Form2s close event.. I have code to show a message box when they
close without saving...

Public Form2_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If FileNotSaved() Then
MessageBox("Do you wish to save?", MsgBoxStyle.Exclamation +
MsgBoxStyle.YesNo, "Test")
End Sub
End Sub

Now if I close the Form1. The Form2's close event does not fire, What
different should I do?

Thanks
VJ


Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jim H | last post by:
I have a ListBox hold a list of my custom controls (it's UserControl based control with a couple radio buttons and a checkbox). Everything works and displays the way I expected it to. I can move...
2
by: Dean Slindee | last post by:
I would like to show an owned form at a predetermined spot on the screen relative to the the owner form's position on the screen (example: frmOwner.Top + 100 and frmOwner.Left + 50). How to do? ...
2
by: Bruce D | last post by:
I have a form that opens up with my application. It acts as the main menu. Let's just say it looks like this: Public Class frmStartup ' some other settings Public UserID As Integer = 0 ' a...
12
by: Tom W | last post by:
What's the difference in these three?
2
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
3
by: Don | last post by:
If you have a form that calls another form via the following code: Dim myForm as Form2 myForm = New Form2 myForm.Owner = Me MyForm.ShowDialog and you minimize the second form, the first form...
0
by: Polanski24 | last post by:
Hello! It was simple in .NET 1.1 public void SetOwner(Form owner) { if (this.InvokeRequired) { this.Invoke( new OwnerSetDelegate(this.SetOwner), new object { owner });
4
by: normb | last post by:
My name is Norm, I changed something that caused this problem, and I do not what it was. I also do not know how to debug this problem! The line where the crash occures is marked by an *. The...
10
by: SimeonD | last post by:
Hi Is there a way I can fnd the Owner of a folder, using vb.net? I know how to find the permissions, but I can't figure how to find the owner. Thanks SimeonD
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.