Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 9th, 2005, 03:52 PM
Friend of Wrox
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default ContextMenuStrip problems


I have a ToolStripTextBox in a ContextMenuStrip in a 2.0 windows form. I want to type text into it, and then hit enter, and then do what I want to do. The problem is is that the textbox doesn't recognize the KeyUp event when Enter is hit. AllowReturn is false, on the form KeyPreview is true. The way that I did it was use a keyup event on the contextmenustrip which works, but isn't the way I want to do it.

How can I get that textbox to recognize the Enter key? I should also note that the contextmenustrip only recognizes the enter key on the number pad and not the main enter key.


  #2 (permalink)  
Old November 17th, 2005, 10:27 AM
Friend of Wrox
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma

Interesting problem you have run into here. Well when you press enter it is recieved as a window close command
by the context menu control window. That is why no key ups are ever recieved on this window 'cause as soon as enter key is pressed Down (it doesnt wait for it to get back Up) context meny window starts packing up and once its closed there are no controls to recieve the KeyUps.

U can counter this beheviour if u refuse to close the context window down on Enter key- in the Closing event of ContextMenuStrip control. (u can do that by assignin true to Cancel property of ToolStripDropDownClosingEventArgs parameter). while you are keeping the context menu control window from closing itself you will get all the events you want. once you are though you can close the window yourself.

Ankur Verma

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems already! KennySargent BOOK: Professional XNA Programming 2nd Edition ISBN: 978-0-470-26128-6 4 April 7th, 2008 03:36 AM
c problems saurabh1983in C++ Programming 6 November 29th, 2005 04:23 AM
validate.asp problems and logon.asp problems p2ptolu Classic ASP Databases 0 February 16th, 2005 02:34 PM
Problems kilika Javascript 1 October 3rd, 2003 02:42 AM

All times are GMT -4. The time now is 04:57 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.