By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,573 Members | 1,806 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,573 IT Pros & Developers. It's quick & easy.

Menu items name

P: n/a
In VB.net menus, there is a name property, but it isnt
available in runtime..strange!!!

does someone has a idea how i can do something similar?

reason i want it is...in my app the UI text comes from a
language table in database. For form and control text i
retrieve it using the formname+control name. But doing the
same thing for menu is not possible. One idea is to store
the name of the menu item e.g. mnuFile in the text itself
and at runtime change the text by using the original text
of the menuitem. Drawback is, at runtime i cannot get the
UI text twice as now the control has lost its name.

Regards

Sachin
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Sachin D." <in**@baroc.co.in> scripsit:
In VB.net menus, there is a name property, but it isnt
available in runtime..strange!!!

does someone has a idea how i can do something similar?

reason i want it is...in my app the UI text comes from a
language table in database. For form and control text i
retrieve it using the formname+control name. But doing the
same thing for menu is not possible. One idea is to store
the name of the menu item e.g. mnuFile in the text itself
and at runtime change the text by using the original text
of the menuitem. Drawback is, at runtime i cannot get the
UI text twice as now the control has lost its name.


<http://www.google.de/groups?as_q=author%3Aherfried%20menuitem%20name&ie =UTF-8>

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

P: n/a
Yust a suggestion.
..net offers a different sollution for multilangual forms, localizable forms.
using the localizable and language properties. you might want to explore
that option 2.
"Sachin D." <in**@baroc.co.in> wrote in message
news:0d****************************@phx.gbl...
In VB.net menus, there is a name property, but it isnt
available in runtime..strange!!!

does someone has a idea how i can do something similar?

reason i want it is...in my app the UI text comes from a
language table in database. For form and control text i
retrieve it using the formname+control name. But doing the
same thing for menu is not possible. One idea is to store
the name of the menu item e.g. mnuFile in the text itself
and at runtime change the text by using the original text
of the menuitem. Drawback is, at runtime i cannot get the
UI text twice as now the control has lost its name.

Regards

Sachin

Nov 20 '05 #3

P: n/a
Hi Sachin,

The code below might help you play with your menus - when you've explored
creating your own MenuItem class and looked into Localisation. ;-)

Regards,
Fergus

<code>
Public Module MenuStuff

Public Function GetMenuItems (F As Form) As ArrayList
Dim alMenuItems As New ArrayList
Dim oMainMenu As MainMenu = F.Menu

If oMainMenu Is Nothing OrElse _
oMainMenu.MenuItems Is Nothing Then _
Return alMenuItems

GetMenuItems (alMenuItems, oMainMenu.MenuItems)
Return alMenuItems
End Function

Private Sub GetMenuItems (alMenuItems As ArrayList, _
aoMenuItems As Menu.MenuItemCollection)
alMenuItems.AddRange (aoMenuItems)
Dim oMenuItem As MenuItem
For Each oMenuItem In aoMenuItems
GetMenuItems (alMenuItems, oMenuItem.MenuItems)
Next
End Sub
End Module

Sub DisplayMenus (F As Form)
Dim alMenuItems As ArrayList = GetMenuItems(F)
Dim oMenuItem As MenuItem
For Each oMenuItem In alMenuItems
Console.WriteLine (oMenuItem.Text)
Next
End Sub
</code>
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.