473,321 Members | 1,748 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,321 software developers and data experts.

mdi with and childform closing

I can open several childforms with the following sub in de mdi form after
clicking a button

Private Sub NewWindow()

Dim ch As New ChildForm()
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren.Length.ToString
ch.Show()

end sub

I want to open automatically a new childform when the last childform is
closed or closing.

I have tried with a event but changing the line in the sub in <dim
Withevents
ch as new Childform()> fails.

Thanks for any response.

Nov 20 '05 #1
6 1568
"andreas" <an*****@pandora.be> schrieb
I can open several childforms with the following sub in de mdi form
after clicking a button

Private Sub NewWindow()

Dim ch As New ChildForm()
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren.Length.ToString
ch.Show()

end sub

I want to open automatically a new childform when the last childform
is closed or closing.

I have tried with a event but changing the line in the sub in <dim
Withevents
ch as new Childform()> fails.


Withevents can only be used at class level because it internally adds
properties to the class. Properties can only be at class level, not a
procedure level. Use Addhandler/RemoveHandler instead.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
"andreas" <an*****@pandora.be> schrieb
I can open several childforms with the following sub in de mdi form
after clicking a button

Private Sub NewWindow()

Dim ch As New ChildForm()
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren.Length.ToString
ch.Show()

end sub

I want to open automatically a new childform when the last childform
is closed or closing.

I have tried with a event but changing the line in the sub in <dim
Withevents
ch as new Childform()> fails.


Withevents can only be used at class level because it internally adds
properties to the class. Properties can only be at class level, not a
procedure level. Use Addhandler/RemoveHandler instead.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Thanks for the information.
I tried addhandler/removehandler but has no solution.
Who gives me a sample code ?
F.e. after closing a child let run a sub in the parent form

"Armin Zingler" <az*******@freenet.de> schreef in bericht
news:40***********************@news.freenet.de...
"andreas" <an*****@pandora.be> schrieb
I can open several childforms with the following sub in de mdi form
after clicking a button

Private Sub NewWindow()

Dim ch As New ChildForm()
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren.Length.ToString
ch.Show()

end sub

I want to open automatically a new childform when the last childform
is closed or closing.

I have tried with a event but changing the line in the sub in <dim
Withevents
ch as new Childform()> fails.


Withevents can only be used at class level because it internally adds
properties to the class. Properties can only be at class level, not a
procedure level. Use Addhandler/RemoveHandler instead.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
Thanks for the information.
I tried addhandler/removehandler but has no solution.
Who gives me a sample code ?
F.e. after closing a child let run a sub in the parent form

"Armin Zingler" <az*******@freenet.de> schreef in bericht
news:40***********************@news.freenet.de...
"andreas" <an*****@pandora.be> schrieb
I can open several childforms with the following sub in de mdi form
after clicking a button

Private Sub NewWindow()

Dim ch As New ChildForm()
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren.Length.ToString
ch.Show()

end sub

I want to open automatically a new childform when the last childform
is closed or closing.

I have tried with a event but changing the line in the sub in <dim
Withevents
ch as new Childform()> fails.


Withevents can only be used at class level because it internally adds
properties to the class. Properties can only be at class level, not a
procedure level. Use Addhandler/RemoveHandler instead.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
"andreas" <an*****@pandora.be> schrieb
Thanks for the information.
I tried addhandler/removehandler but has no solution.
Who gives me a sample code ?
Dim ch As New ChildForm()
addhandler ch.closed, addressof onchildformclosed
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren.Length.ToString
ch.Show()

private sub onchildformclosed(...)
removehandler (directcast(sender, form)).closed, _
addressof onchildformclosed
'open another form as written in your first post F.e. after closing a child let run a sub in the parent form

'this can also be done here
end sub

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6
"andreas" <an*****@pandora.be> schrieb
Thanks for the information.
I tried addhandler/removehandler but has no solution.
Who gives me a sample code ?
Dim ch As New ChildForm()
addhandler ch.closed, addressof onchildformclosed
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren.Length.ToString
ch.Show()

private sub onchildformclosed(...)
removehandler (directcast(sender, form)).closed, _
addressof onchildformclosed
'open another form as written in your first post F.e. after closing a child let run a sub in the parent form

'this can also be done here
end sub

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #7

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

Similar topics

0
by: Jeff | last post by:
IDE: Visual Studio 2003 .NET OS: Xp pro I'm wondering is it possible in visual studio to create childforms with layout like the Solution Explorer in VS? More specific: What is the setting in...
6
by: Al the programmer | last post by:
I want to catch the Closing event for my form. I created a test windows app using the wizard. I then create the Closing event by clicking the lightning bolt on the properties pane. The code is...
2
by: andreas | last post by:
I have a program with a mdiform and same childforms (with a textbox) that i open. All works fine. In the childform i open another form (for finding and replacing). In a sub in that form i try to...
6
by: andreas | last post by:
I can open several childforms with the following sub in de mdi form after clicking a button Private Sub NewWindow() Dim ch As New ChildForm() ch.MdiParent = Me ch.Text = "Textwindow nr " &...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
1
by: Rich | last post by:
Hello, I have a child form in a parent MDI form. The childform is being shrunk and cannot be resized when screen resolution is 800x600. The end user who uses my app cannot see stuff on the...
2
by: Michael | last post by:
if i open the connection of datbase in the parentForm, i want to read table from ChildForm, but it show blank; how do i do?
3
by: Peted | last post by:
I have a simple c# app that opens a child form in a mdi parent. I want the child form to open in the center of the mdi parent, so i can open the child form ok, it all works fine, but setting ...
0
by: thesti | last post by:
hello, i have some labels in my MDIParent form, they are greeting labels for the logged in user. when i open a childform, the labels cover the opened childform, while actually i expect that the...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.