Hi,
I have a main menu which parent mdi form
and i opening two mdi child form (frm1,frm2) with listview doubleclick
event on main menu..
ex:
Dim frm As New frm1

frm.MdiParent = Me

frm.Show()

Ok, there isn't problem
But when two child forms opened, and try this forms open again , i couldn't
use top code , because this code create new same form ..
So i try to activate (focus) opened child form if it is loaded..
I use boolen variabel and set frm1loaded event isfrm1loaded=true when frm1
first created..
Maybe you have a better idea this problem..
So my code:
If Isfrm1 = True Then

frm1.ActiveForm.Focus()

Else

Dim frm As New frm1

frm.MdiParent = Me

frm.Show()

End If


But frm1.ActiveForm.Focus() couldn't work..???
If this frm1 behind to frm2, it isn't come front to frm2 ..
How can i ?
If i use visualbasic 6 , solve tihis problem very easy
But .net form management very complex and i colund't find examples in msdn..

Thanks in advance..


Note:I am from Turkey and my primitive language is Turkish.. Execuse for my
english :)

Re: VB.Net Mdichild focus problem ? by Jose

Jose
Fri Jun 04 08:03:59 CDT 2004

You can enumarate the child forms of a parent with the following code:

System.Windows.Forms.Form[] mdiChildren = this.MdiChildren;
for (int i = 0; i < mdiChildren.Length; i++)
{
System.Windows.Forms.Form frm = (Form) mdiChildren.GetValue(i);
// and now you can use the object frm to check whatever you want
}


I hope this helps.

Jose Luis Manners, MCP


"nomenklatura" <iletisim@operamail.com> wrote in message
news:epgLGyiSEHA.3040@TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a main menu which parent mdi form
> and i opening two mdi child form (frm1,frm2) with listview doubleclick
> event on main menu..
> ex:
> Dim frm As New frm1
>
> frm.MdiParent = Me
>
> frm.Show()
>
> Ok, there isn't problem
> But when two child forms opened, and try this forms open again , i
couldn't
> use top code , because this code create new same form ..
> So i try to activate (focus) opened child form if it is loaded..
> I use boolen variabel and set frm1loaded event isfrm1loaded=true when frm1
> first created..
> Maybe you have a better idea this problem..
> So my code:
> If Isfrm1 = True Then
>
> frm1.ActiveForm.Focus()
>
> Else
>
> Dim frm As New frm1
>
> frm.MdiParent = Me
>
> frm.Show()
>
> End If
>
>
> But frm1.ActiveForm.Focus() couldn't work..???
> If this frm1 behind to frm2, it isn't come front to frm2 ..
> How can i ?
> If i use visualbasic 6 , solve tihis problem very easy
> But .net form management very complex and i colund't find examples in
msdn..
>
> Thanks in advance..
>
>
> Note:I am from Turkey and my primitive language is Turkish.. Execuse for
my
> english :)
>
>
>
>



Re: VB.Net Mdichild focus problem ? by Jose

Jose
Fri Jun 04 08:11:50 CDT 2004

You can even do shomething like this:

for (int i = 0; i < this.MdiChildren.Length; i++)
{
System.Windows.Forms.Form frm = (Form) this.MdiChildren.GetValue(i);

if (frm.Text.Equals("Child Form 1"))
{
frm.Activate();
break;
}
}

Regards,

Jose Luis Manners, MCP


"nomenklatura" <iletisim@operamail.com> wrote in message
news:epgLGyiSEHA.3040@TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a main menu which parent mdi form
> and i opening two mdi child form (frm1,frm2) with listview doubleclick
> event on main menu..
> ex:
> Dim frm As New frm1
>
> frm.MdiParent = Me
>
> frm.Show()
>
> Ok, there isn't problem
> But when two child forms opened, and try this forms open again , i
couldn't
> use top code , because this code create new same form ..
> So i try to activate (focus) opened child form if it is loaded..
> I use boolen variabel and set frm1loaded event isfrm1loaded=true when frm1
> first created..
> Maybe you have a better idea this problem..
> So my code:
> If Isfrm1 = True Then
>
> frm1.ActiveForm.Focus()
>
> Else
>
> Dim frm As New frm1
>
> frm.MdiParent = Me
>
> frm.Show()
>
> End If
>
>
> But frm1.ActiveForm.Focus() couldn't work..???
> If this frm1 behind to frm2, it isn't come front to frm2 ..
> How can i ?
> If i use visualbasic 6 , solve tihis problem very easy
> But .net form management very complex and i colund't find examples in
msdn..
>
> Thanks in advance..
>
>
> Note:I am from Turkey and my primitive language is Turkish.. Execuse for
my
> english :)
>
>
>
>



Re: VB.Net Mdichild focus problem ? by nomenklatura

nomenklatura
Sat Jun 05 03:52:32 CDT 2004

Thanks a lot..
But i have got about 200 forms ..
so for next loop is very slow method for this project

"Jose Luis Manners" <jlmanners(-arroba-)acm.org>, iletide þunu yazdý
news:uRmJEWjSEHA.2780@TK2MSFTNGP09.phx.gbl...