473,407 Members | 2,320 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,407 software developers and data experts.

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_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles TextBox1.KeyDown
'
'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 3733
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***********@lycos.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_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles TextBox1.KeyDown
'
'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.KeyEventArgs)
'--Do whatever
MyBase.OnKeydown(e)
End Sub
"Colin McGuire" <co***********@lycos.co.uk> wrote in message
news:ab**************************@posting.google.c om...
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_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles TextBox1.KeyDown
'
'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
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 ( (...
2
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...
1
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...
1
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...
3
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...
2
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...
0
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...
3
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.