473,761 Members | 4,511 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1603
"andreas" <an*****@pandor a.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*****@pandor a.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*******@free net.de> schreef in bericht
news:40******** *************** @news.freenet.d e...
"andreas" <an*****@pandor a.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*******@free net.de> schreef in bericht
news:40******** *************** @news.freenet.d e...
"andreas" <an*****@pandor a.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*****@pandor a.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 onchildformclos ed
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren. Length.ToString
ch.Show()

private sub onchildformclos ed(...)
removehandler (directcast(sen der, form)).closed, _
addressof onchildformclos ed
'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*****@pandor a.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 onchildformclos ed
ch.MdiParent = Me
ch.Text = "Textwindow nr " & Me.MdiChildren. Length.ToString
ch.Show()

private sub onchildformclos ed(...)
removehandler (directcast(sen der, form)).closed, _
addressof onchildformclos ed
'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
1009
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 tab-controll, that place the tabs at the buttom??
6
5664
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 added to the app but my app won't compile. It generates a "Test.Form1.Closing() denotes a 'method' which is not valid in the given context" error.
2
1928
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 write there mdiform.activechildform.textbox.text but that fails because activechildform should not be a member of mdiform. I don't see why. The goal is to reach the textbox of the active childform. For those who has the book form Evangelos...
6
854
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 " & Me.MdiChildren.Length.ToString ch.Show()
10
4029
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
1
2722
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 screen too well if the resolution is smaller than 800x600 (why did it have to be my app?) Yes, I know, get a bigger screen - $$. Management is on it - just not right now. The parent form can be resized but not the child form. What is the way...
2
1095
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
4312
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 frmConfig = new ConfigForm(this); frmConfig.MdiParent = this; frmConfig.TopLevel = false; frmConfig.StartPosition = FormStartPosition.CenterParent;
0
1230
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 labels will be covered by the childform. can i bring the childform to front, or is there any way to get the labels covered by the childform? Thank you.
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.