Louise,
You seem to be trying to mix WinForms and WebForms, which you can't. The
Textbox in asp.net is an instance of System.Web.UI.WebControls.TextBox,
which is not the same as in winforms (System.Windows.Forms.TextBox). The
ASP.Net one doesn't expose a KeyPress event, and if it did, the event
argument surely wouldn't be found in System.Windows.Forms*, but rather in
System.Web.UI.*
System.Web.UI.TextBox exposes a TextChanged event and that's pretty much it.
If you want to catch OnKeyPress you'll need to use javascript on the client.
The error you are getting is because you didn't reference
System.Windows.Forms to your code, which defines the System.Windows*
namespace. As such, System.Windows* is unrecognized. Again, simply adding
the reference might remove that error, but it won't work like you want
(winforms != webforms).
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"louise raisbeck" <lo************@discussions.microsoft.com> wrote in
message news:D1**********************************@microsof t.com...
What do I have to import at the top of my aspx page (c#) when getting this
error message?
i tried <% Import namespace="System.Windows.Forms.KeyPressEventArgs" %>
but it erros something along the lines of 'Windows not recognised in
System' I'm not sure I understand how to include classes. I'm only trying to
recognise an enter key pressed in a text box.