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

open child-form

Hello,

I think a lot of people already asked my question!
I'm learning vb.net and now I have a MDI-parent with one child. Everytime I
press a button to open the child it will open a new form. I want to open a
new child-form when it isn't already open. If the child-form is already
opened I want to put focus to the child-form.

How do I have to solve this problem?

Greets,

Filip
Dec 28 '05 #1
1 4953
"Filip Vanderstappen" <fi*******************@skynet.be> schrieb:
I'm learning vb.net and now I have a MDI-parent with one child. Everytime
I press a button to open the child it will open a new form. I want to open
a new child-form when it isn't already open. If the child-form is already
opened I want to put focus to the child-form.


\\\
Private m_Child As Form2

Private Sub Button1_Click( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles Button1.Click
If m_Child Is Nothing Then
m_Child = New Form2()
m_Child .MdiParent = Me
AddHandler m_Child.Load, AddressOf Me.MdiChild_Load
AddHandler m_Child.Closed, AddressOf Me.MdiChild_Closed
m_Child.Show()
Else
m_Child.Activate()
End If
End Sub

Private Sub MdiChild_Load( _
ByVal sender As Object, _
ByVal e As EventArgs _
)
MsgBox( _
"MDI child with handle " & _
DirectCast(sender, Form).Handle.ToString() & _
" loaded!" _
)
End Sub

Private Sub MdiChild_Closed( _
ByVal sender As Object, _
ByVal e As EventArgs _
)
MsgBox( _
"MDI child with handle " & _
DirectCast(sender, Form).Handle.ToString() & _
" closed!" _
)
m_Child = Nothing
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 28 '05 #2

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

Similar topics

0
by: Marco Nicosia | last post by:
Hello gang, My coworker and I are writing a Python class for the other developers within our team. This class is supposed to encapsulate several things, including daemonizing, setting up...
3
by: J.R | last post by:
I'm trying to determine if a named child window has been opened before opening a new one, however my challenge is that the child window may have been opened from a parent that no longer exists,...
3
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The...
1
by: H2 | last post by:
Hi all, Any one know how to open a new windows in a child window using javascript? What I need to do is that, in my main page, there is a button, onclick, it opens one child windows. In the child...
1
by: ian.michel | last post by:
I have a parent window that pushes a new window object onto an Array with the following code : OpenChild() { //totalNumWindowsCreated is global totalNumWindowsCreated =...
2
by: John Dalberg | last post by:
I have a closed box system which opens an html page. The page closes by the system. I have access to the html page. I added code to open a child window from this page. However when the parent...
6
by: slacker | last post by:
In my jsp I have: <Script langauge="Javascript"> window.location.replace("first url"); window.close(); window.open("second url"); </Script> The child window opens from the parent window...
6
by: Jack | last post by:
I have a main webpage that has a list of records, each with a link to a window.open function call. As an example, a page that opens is editrecord.aspx?RecordID=34, and another is...
2
by: Robert Degen | last post by:
Hello, I got a little problem. Seems very simple: * I want to open a popup window * Popup-window uses data from its father window. BUT a parent.window does NOT point to the real parents...
0
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi just wondering if anyone knows if there is a way to tell if a child window is still open in the code behind in the parent window (web application vs.net 2005)? I have a web app and am using the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.