Results 1 to 4 of 4

Thread: [RESOLVED] Add search to contextmenu

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    683

    Resolved [RESOLVED] Add search to contextmenu

    I have added a contextmenu to my form and added the cut, paste, copy and now I want to add Search but what I would like is the standard textbox with the word search beside it, rather than have popup with search functions. I have figured out how to do the search on the bindingsource. I know how to just add a textbox on the context menu but I cannot see how to put any text beside it. Does everyone just use a popup?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Add search to contextmenu

    There is no way to do that because there is no ToolStripItem with that functionality. Each item on the ContextMenuStrip is a ToolStripItem. A ToolStripTextBox is derived from ToolStripItem and ToolStripMenuItem is also derived from ToolStripItem. Each item on the menu can be one or the other but not both. You could either use two different items (see screen shot) and simply not handle the Click event of the label, or else you can derive your own class from ToolStripItem that provides the functionality you want.
    Attached Images Attached Images  
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    683

    Re: Add search to contextmenu

    Thanks, yes, that is what I am doing now. I was just hoping that I could do it all on one line.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Add search to contextmenu

    Quote Originally Posted by Beast777
    I was just hoping that I could do it all on one line.
    and you can, as I said, by creating your own class. You can't expect the Framework to provide everything you want, but it does provide the means to create anything you want. If you want one ToolStripItem that has a text label and a text box then create one.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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