In order to read your question I first have to download the zip file. Then I have to unzip it, only to discover that you have posted the information in a docx file, which my Word 2003 is incapable of reading (unless I go hunting for a plugin that Microsoft has posted somewhere to allow me to read docx files).

It would really be much easier if you would post your question (and related code, if any) in clear text in this thread. If you could do that I would be happy to have a look and reply if I have any advice to offer.

Comments
You fell for the old .docx zipped file trick? LMAOO xD, though brownie point for taking the time to help someone lost, when it comes to asking a question. :)

I need to create the following windows form applications in VB:

1:
I have to create an application that will dynamically add a menu strip with menu items to a form(ie NOT dragged and dropped onto the form) in Visual Basic. The menu strip should be created in the Form_Load event handler.
I have to use a TextBox for user input. If the user enters information into the TextBox and clicks on the Add Button, the text should be added to a ComboBox control.A Menu should then be created that must be added to the menu strip dynamically.
There should be a second TextBox that will be used to add a new menu item to the menu that is currently selected in the ComboBox.
When a menu item is selected, it must simply display a MessageBox with the items name (For example, adding a menu item called View would display a MessageBox with the message “View”)

2:
I have to create a quiz machine program in in Visual Basic with the following:
A menu strip that must be created programmatically (ie NOT dragged and dropped onto the form). There should be an exit option added to the menu strip that must exit the application.
A structure must be created to encapsulate all the questions and suggested answers. The structure must contain:
Question String
Answers Collection
Correct Answer String
When the form loads, 5 questions must be created in code using these structures. These 5 structures will then serve as the quiz. The user must be shown the first question, and have the option of browsing forwards and backwards through the quiz. The program should store saved answers to select the radio button when users cycle through. This can be done by any means possible, for example an ArrayList or SortedList.
I have to ensure that the suggested answers are randomized the first time the form loads only.
Once the user has selected an answer for every question, the Submit button should be enabled. When the user clicks this button, the program must then evaluate the quiz and compare the users selected answers against the correct answer. A valid message must then be displayed via a MessageBox indicating the user's score.
I desperately need the code to create these applications!

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Declare main menu
        Dim mnuMain As MainMenu = New MainMenu()

        'Add submenu with menu item
        Dim mnuItem As MenuItem = mnuMain.MenuItems.Add("Colour") 
        mnuItem.MenuItems.Add(New MenuItem("Red"))
        mnuItem.MenuItems.Add(New MenuItem("Blue")) 
        Me.Menu = mnuMain

        'Add event-handler to each MenuItems
        For Each m As MenuItem In mnuItem.MenuItems
            AddHandler m.Click, AddressOf HandleMenuItemClick
        Next
    End Sub

    'Event-handler to handle any and all MenuItem clicks
    Private Sub HandleMenuItemClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'Throw exception if the sender is not a menu item
        If (Not (TypeOf (sender) Is MenuItem)) Then
            Throw New Exception("HandleMenuItemClick called incorrectly!")
        End If
        'Convert sender to menu item type
        Dim s As MenuItem = CType(sender, MenuItem)
        Select Case s.Text
            'Response will be a messagebox that displays the selected menu item's text
            Case "Red" 'User is informed that red was clicked
                MessageBox.Show("You clicked red")
            Case "Blue" ' User is informed that blue was clicked
                Messagebox.Show("You clicked blue")
                Application.Exit()
        End Select
    End Sub
End Class

This is a coding example of how to create a Main menu and then add items to it. Add handler is used to handle the events. What I need to know is how do you create new menu items via textboxes, if you are supposed to create the Menu in the Form_Load event handler? Whenever I try to add the items to an array or try to call them outside the Form_Load event handler, it's always unreachable/out of scope. What should I do?

Declare the menu outside the Form1_Load event and then instanciate it as a new MainMenu inside Form1_Load.

Public Class Form1
    Private mnuMain As MainMenu

    Private Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
        mnuMain = New MainMenu()

That will allow you to get access to the main menu from anywhere inside the Form1 code.

Create a new project and add one button named btnAddMenu. Then paste in the following code. When you run it you will have a form with only the button. Clicking on the button will add a menu with event handlers. Play around with it.

Public Class Form1

    Private Sub btnAddMenu_Click(sender As System.Object, e As System.EventArgs) Handles btnAddMenu.Click

        'create the file sub-menus

        Dim mnuFileOpen As New System.Windows.Forms.ToolStripMenuItem()
        mnuFileOpen.Name = "mnuFileOpen"
        mnuFileOpen.Size = New System.Drawing.Size(152, 22)
        mnuFileOpen.Text = "Open"
        AddHandler mnuFileOpen.Click, AddressOf mnuFileOpen_Click

        Dim mnuFileClose As New System.Windows.Forms.ToolStripMenuItem()
        mnuFileClose.Name = "mnuFileClose"
        mnuFileClose.Size = New System.Drawing.Size(152, 22)
        mnuFileClose.Text = "Close"
        AddHandler mnuFileClose.Click, AddressOf mnuFileClose_Click

        Dim mnuFileExit As New System.Windows.Forms.ToolStripMenuItem()
        mnuFileExit.Name = "mnuFileExit"
        mnuFileExit.Size = New System.Drawing.Size(152, 22)
        mnuFileExit.Text = "Exit"
        AddHandler mnuFileExit.Click, AddressOf mnuFileExit_Click

        'create the file menu and add the sub-menu items

        Dim mnuFile As New System.Windows.Forms.ToolStripMenuItem()
        mnuFile.Name = "mnuFile"
        mnuFile.Size = New System.Drawing.Size(37, 20)
        mnuFile.Text = "File"
        mnuFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {mnuFileOpen, mnuFileClose, mnuFileExit})

        'create the edit sub-menus

        Dim mnuEditCopy As New System.Windows.Forms.ToolStripMenuItem()
        mnuEditCopy.Name = "mnuEditCopy"
        mnuEditCopy.Size = New System.Drawing.Size(152, 22)
        mnuEditCopy.Text = "Copy"
        AddHandler mnuEditCopy.Click, AddressOf mnuEditCopy_Click

        Dim mnuEditCut As New System.Windows.Forms.ToolStripMenuItem()
        mnuEditCut.Name = "mnuEditCut"
        mnuEditCut.Size = New System.Drawing.Size(152, 22)
        mnuEditCut.Text = "Cut"
        AddHandler mnuEditCut.Click, AddressOf mnuEditCut_Click

        Dim mnuEditPaste As New System.Windows.Forms.ToolStripMenuItem()
        mnuEditPaste.Name = "mnuEditPaste"
        mnuEditPaste.Size = New System.Drawing.Size(152, 22)
        mnuEditPaste.Text = "Paste"
        AddHandler mnuEditPaste.Click, AddressOf mnuEditPaste_Click

        'create the edit menu and add the sub-menu items

        Dim mnuEdit As New System.Windows.Forms.ToolStripMenuItem()
        mnuEdit.Name = "mnuEdit"
        mnuEdit.Size = New System.Drawing.Size(39, 20)
        mnuEdit.Text = "Edit"
        mnuEdit.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {mnuEditCopy, mnuEditCut, mnuEditPaste})

        'create the main menu and add the sub-menu items

        Dim mnuMain As New System.Windows.Forms.MenuStrip()
        mnuMain.Location = New System.Drawing.Point(0, 0)
        mnuMain.Name = "mnuMain"
        mnuMain.Size = New System.Drawing.Size(284, 24)
        mnuMain.TabIndex = 0
        mnuMain.Text = "Main Menu"
        mnuMain.Items.AddRange(New System.Windows.Forms.ToolStripItem() {mnuFile, mnuEdit})

        'add the main menu to the form

        Me.Controls.Add(mnuMain)

     End Sub

    Private Sub mnuFileOpen_Click(sender As System.Object, e As System.EventArgs)
        MsgBox("file open")
    End Sub

    Private Sub mnuFileClose_Click(sender As System.Object, e As System.EventArgs)
        MsgBox("file close")
    End Sub

    Private Sub mnuFileExit_Click(sender As System.Object, e As System.EventArgs)
        MsgBox("file exit")
    End Sub

    Private Sub mnuEditCopy_Click(sender As System.Object, e As System.EventArgs)
        MsgBox("edit copy")
    End Sub

    Private Sub mnuEditCut_Click(sender As System.Object, e As System.EventArgs)
        MsgBox("edit cut")
    End Sub

    Private Sub mnuEditPaste_Click(sender As System.Object, e As System.EventArgs)
        MsgBox("edit paste")
    End Sub

End Class

Whereas building menus in the IDE is a top-down approach, doing the same at run time is more bottom-up. You create the lower level items first. Once the sub-menu items are defined you create a higher level menu then add the sub-items. Once you have done this for "File" and "Edit" you create the main menu and add File and Edit items. The final step is to add the completed menu structure to the main form. Note that it is not necessary to have a class level reference to any of the menu items. Once attached to the form you no longer need to maintain references to the individual menu items. You will see this in action as you use the menu items.

This article has been dead for over six months. Start a new discussion instead.