Results 1 to 3 of 3

Thread: I need help with context menu

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    London
    Posts
    6

    I need help with context menu

    What I have in my project:

    01 btnphone
    01 context menu 2 items (phone,mobile)
    associated to btnphone
    01 textBox (txtPhone)
    ==============
    Private btnphoneContextMenu As ContextMenu
    Private Sub btnphone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If btnphoneContextMenu Is Nothing Then
    btnphoneContextMenu = New ContextMenu()
    With btnphoneContextMenu
    .MenuItems.Add("Phone Home", AddressOf ButtonMenuHandler)
    .MenuItems.Add("Phone work", AddressOf ButtonMenuHandler)
    End With
    Button1.ContextMenu = btnphoneContextMenu
    End If
    End Sub


    Private Sub ButtonMenuHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim item As MenuItem
    item = CType(sender, MenuItem)

    '//NOW I AM LOST

    End Sub

    ===================

    I have and address book user inputs Name,surname,City etc....
    now when user gets to the type in the phone number,they
    write the phoneNumber in the txtphone.text and
    then press btnphone and the context menu appear
    toogle the menu items the associated number must appear in the
    txtphone.text and persist in a variable.
    so that i can later save them .

    I HAVE ASSOCIATED THE MENU WITH A BTN BUT I AM LOST
    WHEN I HAVE TO PERSIST THE PHONE NUMBERS SOMEWHERE
    SO THAT THE USER CAN TOOGLE THE MENU ITEMS AND THE ASSOCIATED PHONE NUMBER WILL APPEAR.

    Can you help me with a small example .?
    Getting crazy here

    thanks a lot anyway.

    Gabriel
    Thanks for your help and suggestion
    Gabriel

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Hey welcome to the forum. For future reference, when posting code use the
    VB Code:
    1. code
    tags, you'll get a lot more response that way. I 'll to figure out something and post it later.

    Dev

  3. #3
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    VB Code:
    1. Private btnphoneContextMenu As ContextMenu
    2. Private Sub btnphone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    3. If btnphoneContextMenu Is Nothing Then
    4. btnphoneContextMenu = New ContextMenu()
    5. With btnphoneContextMenu
    6. .MenuItems.Add("Phone Home", AddressOf ButtonMenuHandler)
    7. .MenuItems.Add("Phone work", AddressOf ButtonMenuHandler)
    8. End With
    9. Button1.ContextMenu = btnphoneContextMenu
    10. End If
    11. End Sub
    12.  
    13.  
    14. Private Sub ButtonMenuHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
    15. Dim item As MenuItem
    16. item = CType(sender, MenuItem)
    17.  
    18. '//NOW I AM LOST
    19.  
    20. End Sub

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