By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,457 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,457 IT Pros & Developers. It's quick & easy.

TextBox KeyDown event

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
* 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

P: n/a

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 discussion thread is closed

Replies have been disabled for this discussion.