home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,831 of 10,840   
   Jay Taplin to Bob Kochem   
   Re: Addressing Menu Items   
   14 Jan 06 20:58:41   
   
   From: jtaplin@integraware.com   
      
   You can do this with the controls collection of the form.   
      
   The following code loops through all the controls on the form, checking for   
   the type of the control.  If it comes back as "Menu", then it is a menu   
   control/object.  In other words, if the code makes it to the Debug.Print   
   line, then you have found a menu item.  Good luck!   
      
   Private Sub Command1_Click()   
       Dim ctl As VB.Control   
      
       For Each ctl In Me.Controls   
           If StrComp(TypeName(ctl), "Menu", vbTextCompare) = 0 Then   
               'Found a menu item   
               Debug.Print ctl.Name   
           End If   
       Next   
      
       Set ctl = Nothing   
   End Sub   
      
   "Bob Kochem"  wrote in message   
   news:JKfyf.788$SD3.741@trndny07...   
   > [I apologize if this is an incredibly newbie question ...]   
   >   
   > I am looking for a way via code to access all the menu itmes on a given   
   > form. I am looking for something like the Forms or Controls collections,   
   > but for menu items. Is there such a thing or method? I would prefer to   
   > avoid using the Win API but will do so if that's the only way available.   
   >   
   > This is for a language-translation (of an existing program) where I wish   
   > to change (English to Spanish initially)  the Descriptions for all the   
   > menu items.   
   >   
   > Thanks in advance   
   >   
   > Bob K.   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca