System.KeyPressEventHandler (does it exist?)

  • Thread starter Thread starter Claudia Fong
  • Start date Start date
C

Claudia Fong

Hi,

I know there is a textBox1_KeyPress event, but what is the name should I
put after the
InitializeComponent()


this.textBox1.KeyPress += new
System.KeyPressEventHandler(this.textBox1_KeyPress); -- C# said the
error below:


The type or namespace name 'KeyPressEventHandler' does not exist in the
class or namespace 'System' (are you missing an assembly reference?)

Can someone tell me what is the correct word??



Cheers!

Claudi
 
Hello,
KeyPressEventHandler is not a part of System namespace.It is a part of
System.Windows.Forms namespace. You can put it like this:

textBox1.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);

HTH. Cheers :)
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
 
Back
Top