Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / April 2007

Tip: Looking for answers? Try searching our database.

Can someone help me with this menu?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carol - 30 Apr 2007 09:43 GMT
I'm fairly new at this and trying to create a dynamic menu.

I use the function getMANames to put all the submenu item names into
an array. I am confident this sub is working properly.

When I look in debug mode the object insertJobMenu is reporting the
correct number of items. If I look at one of those items it has the
correct name. However when I run the code I don't get a drop-down
menu. I can see "InsertJobs" on the menu bar, however when I hover
over it nothing happens. Can anyone tell me what I'm doing wrong?

       Dim insertJobMenu As New MenuItem("InsertJobs")

       Dim MANames As String() = getMANames()
       For i = 0 To UBound(MANames)
           Dim insertMenuItem As New MenuItem(MANames(i))
           insertJobMenu.MenuItems.Add(insertMenuItem)
       Next

       Dim myMenu As New MainMenu(New MenuItem() {insertJobMenu})
       Menu = myMenu

Thanks,
Carol
rowe_newsgroups - 30 Apr 2007 14:38 GMT
> I'm fairly new at this and trying to create a dynamic menu.
>
[quoted text clipped - 20 lines]
> Thanks,
> Carol

Are you sure getMANames() is returning a populated string array? I
modified you code to use a hard coded array since for testing and
everything works fine. Also I suggest you turn on Option Explicit and
Option Strict - looking at your loop it seems they are turned off.

BTW, here's the test code I used:

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

       Dim insertJobMenu As New MenuItem("InsertJobs")

       Dim MANames As String() = {"Item1", "Item2", "Item3"}

       For i As Integer = 0 To UBound(MANames)
           Dim insertMenuItem As New MenuItem(MANames(i))
           insertJobMenu.MenuItems.Add(insertMenuItem)
       Next

       Dim myMenu As New MainMenu(New MenuItem() {insertJobMenu})
       Menu = myMenu

   End Sub

Thanks,

Seth Rowe
Carol - 30 Apr 2007 16:31 GMT
Seth,

thanks so much for putting in the time to try this out - but there
must be something else going on here because I copied in your code and
it's still not working!

I did actually have this working last week, then it stopped, I
couldn't figure out what I'd changed, and it hasn't worked since. Most
frustrating!

I don't really know where I'm supposed to use those options... though
presumably I wouldn't need them just to get your simplified example
working. Could I somehow have turned off drop-down menus for the whole
project?

....  OK I've got it working now, by deleting the menus I'd manually
configured, and the MainMenu1 object from the form designer. Still
don't have a clue why it was doing this but at least I can make some
progress now!

Thanks again,
Carol

> > I'm fairly new at this and trying to create a dynamic menu.
>
[quoted text clipped - 50 lines]
>
> - Show quoted text -

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.