CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2006
    Posts
    228

    VB.net popup menu...

    Hello,

    Is there a way of creating a popup menu in vb.net?

    I want to be able to click a button and it pop up the menu next to the button.

    But, I want the size of the text in the menu a bit bigger.

    anyone know how to do it?

    (I have been trying for a while now and can't work it out)

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: VB.net popup menu...

    You can create a form, any size you want. You can move it, resize it, and then show it.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Mar 2006
    Posts
    228

    Re: VB.net popup menu...

    Hello,

    That is for a form.. I am talking about a menu.

    I want to be able to click on a button and display the menu where the button is.

    I don't want to resize a form or move a form.

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: VB.net popup menu...

    Why not just use the ContextMenu object, on the button's Left Click - instead of Right Click ¿

  5. #5
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: VB.net popup menu...

    Yup, ContextMenuStrip is probably the most straight forward.

    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim nf As New Font(Drawing.FontFamily.GenericSansSerif, 10, FontStyle.Regular)
            ContextMenuStrip1.Font = nf
            ContextMenuStrip1.Show(Button1, 5, 5)
        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

Featured