473,385 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

KeyPress in Control

Hi,

I'm making a form with a statusbar. I added a custom control to
statusbar (That control has only a textbox).

I set KeyPreview to True on the form. Now I can monitor all keys
pressed, but I want to know if it is possible to pass the parent form to
my contol and process keypresses inside my contol, without coding my
contols logic in the main form ?

TIA
Nov 20 '05 #1
2 1140
* Peter Osawa <po****@sun.es> scripsit:
I'm making a form with a statusbar. I added a custom control to
statusbar (That control has only a textbox).

I set KeyPreview to True on the form. Now I can monitor all keys
pressed, but I want to know if it is possible to pass the parent form
to my contol and process keypresses inside my contol, without coding
my contols logic in the main form ?


You can use 'AddHandler' in combination with 'Me.FindForm()' inside the
usercontrol to add a handler to the form's 'KeyPress' event.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #2
Thank you very much !!!
Herfried K. Wagner [MVP] wrote:
* Peter Osawa <po****@sun.es> scripsit:
I'm making a form with a statusbar. I added a custom control to
statusbar (That control has only a textbox).

I set KeyPreview to True on the form. Now I can monitor all keys
pressed, but I want to know if it is possible to pass the parent form
to my contol and process keypresses inside my contol, without coding
my contols logic in the main form ?

You can use 'AddHandler' in combination with 'Me.FindForm()' inside the
usercontrol to add a handler to the form's 'KeyPress' event.

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Trevor Fairchild | last post by:
I'm writing a program that is designed for quick navigation using specific buttons on the keyboard. In doing this, I have added a KeyPress event for every control on the form to intercept the key...
3
by: Peter Verburgh | last post by:
Is there an easy way to capture the keypress - keydown events from a LABEL control ? Standard the control doesn't handle these events. The label control inherits from the control class , and this...
0
by: news.gorge.net | last post by:
I want to fire an event when a user presses Control+C when NOT in a situation where that keypress combo would copy something to the clipboard. My current attempt was to override the...
10
by: Tim Frawley | last post by:
I am attempting to detect a Shift+Tab in the KeyPress event for back navigation on a control that doesn't support this method. Does anyone have any ideas how to compare e.KeyChar to a ShiftTab? ...
6
by: Niksa Baldun | last post by:
Hi, I am trying to capture data from magnetic stripe reader which is connected via keyboard interface (therefore indistinguishable from normal keyboard input). Basically, I am doing the...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I...
2
by: chatelain | last post by:
Ok a couple things I've got going: On the DataGrid1_CurrentCellChanged I add a button control to the datagridtextbox. This occurs when a mouse click happens inside the cell or the cursor enters the...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.