473,769 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox KeyDown event

Hi, can I ask what I should be doing below. For some reason the method
KeyDown doesn't exist in MyBase.
Thank you
Colin
Private Sub TextBox1_KeyDow n(ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs) _
Handles TextBox1.KeyDow n
'
'if something then
' possibly do some things
'end if
'
MyBase.KeyDown( sender, e) 'ERROR HERE, KEYDOWN DOESN'T EXIST
End Sub

BTW, and not that relevant, the 'things' I am wanting to do in the
if/endif structure is detect if a pound, euro, or dollar character is
present, then change the currency in a combobox elsewhere on the form
to show the correct currency. But I still want my keys to be processed
normally so I want to call MyBase.KeyDown and this is why I am trying
to.
Nov 20 '05 #1
3 3774
Cor
Hi Colin,

Easier is to use the keyUp event.
and then something as
e.keyData =
gives you direct all keys
e.keyvalue =
But you see them when you are busy,
start with key.data just to try.

I hope this helps?
Cor

'if something then
' possibly do some things
'end if
'

Nov 20 '05 #2
* co***********@l ycos.co.uk (Colin McGuire) scripsit:
Hi, can I ask what I should be doing below. For some reason the method
KeyDown doesn't exist in MyBase.
'KeyDown' is an event handler.
Private Sub TextBox1_KeyDow n(ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs) _
Handles TextBox1.KeyDow n
'
'if something then
' possibly do some things
'end if
'
MyBase.KeyDown( sender, e) 'ERROR HERE, KEYDOWN DOESN'T EXIST
You don't need that.
End Sub

BTW, and not that relevant, the 'things' I am wanting to do in the
if/endif structure is detect if a pound, euro, or dollar character is
present, then change the currency in a combobox elsewhere on the form
to show the correct currency. But I still want my keys to be processed


Have a look at the properties of 'e' passed to the procedure.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

You call Mybase only when you override an event. Which you didn't do in this
case.

Example:
Protected Overrides Sub OnKeyDown(ByVal e As
System.Windows. Forms.KeyEventA rgs)
'--Do whatever
MyBase.OnKeydow n(e)
End Sub
"Colin McGuire" <co***********@ lycos.co.uk> wrote in message
news:ab******** *************** ***@posting.goo gle.com...
Hi, can I ask what I should be doing below. For some reason the method
KeyDown doesn't exist in MyBase.
Thank you
Colin
Private Sub TextBox1_KeyDow n(ByVal sender As Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs) _
Handles TextBox1.KeyDow n
'
'if something then
' possibly do some things
'end if
'
MyBase.KeyDown( sender, e) 'ERROR HERE, KEYDOWN DOESN'T EXIST
End Sub

BTW, and not that relevant, the 'things' I am wanting to do in the
if/endif structure is detect if a pound, euro, or dollar character is
present, then change the currency in a combobox elsewhere on the form
to show the correct currency. But I still want my keys to be processed
normally so I want to call MyBase.KeyDown and this is why I am trying
to.

Nov 20 '05 #4

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

Similar topics

0
4595
by: Michael Howes | last post by:
I'm trying to handle a number of keystrokes in a TextBox and for other reasons I'm using the KeyDown I'm trying to know when Shift-Tab is pressed and the following code doesn't work if ( ( e.KeyData == Keys.Tab ) ) {
2
12226
by: orekinbck | last post by:
Hi There In C# windows app, .NET 2003 I have a text box with the following event handler: private void textBox3_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.A) e.Handled = true;
1
3310
by: fripper | last post by:
I have a VB 2005 windows app and I want to recognize keydown events. I have a form key down event handler but it does not get control when a key is depressed. In playing around I found that if I add a keydown event handler for some control on the form, say a textbox ... Private Sub txtBox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtBox.KeyDown) and then give that control focus the keydown...
1
2104
by: rocksoft | last post by:
Hi, I am working in asp.net with C# web application, i have used one textbox and image button for search funtion, i have created one user control for this, but after i have entered value in textbox, i have pressed the button, its not at all working, if i will use mouse i can able to search values, how to enable to enter key at keydown event of textbox, the following script i have used ,
3
4303
by: win | last post by:
when the cursor is in a textbox, only coding in the keydown event of the textbox triggered, the coding in the keydown event of the form does not triggered! Problem: I need to change a VB6 program to .Net. It uses function key(e.g. F12) to close the form, now i need to write the coding in the keydown event of all controls form. Can anyone help me? Thanks a lot.
2
1946
by: sush_jd via DotNetMonster.com | last post by:
I am using managed VC++ code in a Win Form App. There is a text box - txtRONumber. I have defined a KeyDown event handler (non-default) for it, like below. InitializeComponent() is being called from Constructor of the Form Class. void InitializeComponent(void) { this->txtRONumber = (gcnew System::Windows::Forms::TextBox()); this->txtRONumber->Location = System::Drawing::Point(151, 35);
0
979
by: Jason Huang | last post by:
Hi, In my C# 1.1 windows form application, I have a KeyPress Event for a TextBox in a DataGrid. But I have some problem with the value of the KeyPress Event. Saying the original value in that TextBox is AA, but when I key in another character B after the 'AA', the value in the KeyPress's sender is still 'AA', not 'AAB'. How do I fix this problem? Thanks for help.
3
3447
by: yellolad | last post by:
Hello friends, I am facing a very strange problem with the Keydown() event. I have a textbox on my page. When ever a key is down on the textbox, I am calling a javascript function to display the character. function monitorKeys(event) { alert(event.keyCode); //This is displaying 219 for
2
2815
by: lenniekuah | last post by:
Hi Friends, Encounter another interesting problem of practical event. I have used FORM KEYDOWN event to navigate the cursor and on the Primary Key TextBox I tried to validate the input after ENTER was pressed it does not work. Here are the coding private void FrmCustomerRef_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Close();
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.