Enumerating MDIList Menu Item at Run-Time

  • Thread starter Thread starter pa.singer
  • Start date Start date
P

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.
 
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
 
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.
 
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
 
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.....
 
Back
Top