Home All Groups Group Topic Archive Search About

Enumerating MDIList Menu Item at Run-Time

Author
19 Apr 2006 4:29 PM
pa.singer
I have an MDIList menu item that I want to enumerate at run-time and
possibly change the text shown for some of the MDI children included in
that list.  When I enumerate the collection for that menu item, none of
the open MDI child windows show in the list although they are clearly
there in the actual drop-down of the menu item.  Does anyone know how I
can enumerate the menu item that contains the MDIList at run-time and
change the text associated with some of the MDI children in that list?

Thank you.

Author
19 Apr 2006 6:34 PM
VJ
The best way to do this is , enumrate the MDI children open, and then change
the text.. something like below... ( I am assuming you are doing the code in
your MDI form)

Dim frmChild as Form

For Each frmChild In Me.MdiChildren

        If  typeof  frm Is Form1 then
            frm.Text = "My New Text"
        else if typeof  frm Is Form2 then
            frm.Text = "My Second Text"
        else if...

        end if

Next frm

VJ


<pa.sin***@verizon.net> wrote in message
Show quoteHide quote
news:1145460980.537494.131210@g10g2000cwb.googlegroups.com...
>I have an MDIList menu item that I want to enumerate at run-time and
> possibly change the text shown for some of the MDI children included in
> that list.  When I enumerate the collection for that menu item, none of
> the open MDI child windows show in the list although they are clearly
> there in the actual drop-down of the menu item.  Does anyone know how I
> can enumerate the menu item that contains the MDIList at run-time and
> change the text associated with some of the MDI children in that list?
>
> Thank you.
>
Author
19 Apr 2006 7:27 PM
pa.singer
Thanks for the feedback.  Unfortunately I want to be able to keep the
text as is on the form title bar and only change the text that shows in
the menu's drop-down items.  Under VB6 I was able to do just that using
miscellaneous APIs (GetMenu, GetSubMenu, etc.) but I'm not having any
success with those APIs within .Net so far.
Author
19 Apr 2006 7:46 PM
VJ
uhmm...interesting.. Yes do remember the VB6.0 days... maybe there is a
Reason they removed it .NET. I assume you have tried the InterOp way, and it
did not work.. ?

VJ

<pa.sin***@verizon.net> wrote in message
Show quoteHide quote
news:1145474836.617056.149550@e56g2000cwe.googlegroups.com...
> Thanks for the feedback.  Unfortunately I want to be able to keep the
> text as is on the form title bar and only change the text that shows in
> the menu's drop-down items.  Under VB6 I was able to do just that using
> miscellaneous APIs (GetMenu, GetSubMenu, etc.) but I'm not having any
> success with those APIs within .Net so far.
>
Author
20 Apr 2006 1:29 PM
pa.singer
Yeah I know I'm in trouble as soon as the GetMenuItemCount API
completes because although that returns without an error, it also
returns with a crazy high number for menu items.  The GetMenuItemInfo
that is used next fails with a System.AccessViolationException -
Attempted to read or write protected memory.....