CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Main Menu Items

  1. #1
    Join Date
    Mar 2006
    Posts
    1

    Post Main Menu Items

    I have put a main menu on my project and in the main menu I have Modifty, Add, and Delete. I'm having problems with the Add and Modify items. I'm not quite sure how to go about it.


    Structure MEMBERPHONES
    Dim FullName As String
    Dim PhoneNumber As String
    End Structure

    Private Sub frmMembershipList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles MyBase.Load
    ListBox1.Items.Add("Adams,Elizabeth")
    ListBox1.Items.Add("Baker,Anna")
    ListBox1.Items.Add("Carter,Antainla")
    ListBox1.Items.Add("Day,Cynthia")
    ListBox1.Items.Add("Evans, Vicky")
    ListBox1.Items.Add("Felty, Kim")
    ListBox1.Items.Add("Gibbs, Jammie")
    ListBox1.Items.Add("Hasty, Veronica")
    ListBox1.Items.Add("Ivey, Terri")
    ListBox1.Items.Add("Joy, Mary")
    ListBox1.Items.Add("Key, Alice")
    End Sub

    Private Sub mmuModify_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles mmuModify.Click
    End Sub

    Private Sub mmuAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles mmuAdd.Click
    Dim strAdd As Integer
    Dim x As MenuItem
    For i As Integer = 0 To 10
    x = New MenuItem
    x.Text = CStr(i)
    AddHandler x.Click, AddressOf mmuAdd_Click
    MainMenu1.MenuItems(0).MenuItems.Add(x)
    Next
    strAdd = MsgBox("Add Item?", vbYesNo, "Add")
    If strAdd = vbYes Then
    ListBox1.Items.Add(txtName.Text)
    ListBox1.Items.Add(txtPhone.Text)
    Else
    MsgBox("Item Not Add")
    End If
    End Sub

    Private Sub mmuDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles mmuDelete.Click
    Dim strDelete As Integer
    Dim x As MenuItem
    For i As Integer = 0 To 10
    x = New MenuItem
    x.Text = CStr(i)
    AddHandler x.Click, AddressOf mmuDelete_Click
    MainMenu1.MenuItems(0).MenuItems.Add(x)
    Next
    strDelete = MsgBox("Delete Item?", vbYesNo, "Delete")
    If strDelete = vbYes Then
    ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
    Else
    MsgBox("Item Not Deleted")
    End If
    End Sub

    Private Sub mmuExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles mmuExit.Click
    Me.Close()
    End Sub
    End Class

  2. #2
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: Main Menu Items

    can u clear what u are trying to do ... thks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured