Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Going Crazy - TextBox KeyPress Event

 
Logged in as: Guest
arrSession:exec spGetSession 2,4,48599
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP.NET >> Going Crazy - TextBox KeyPress Event
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Going Crazy - TextBox KeyPress Event - 6/21/2007 9:14:58 AM   
  bortiquai

 

Posts: 6
Score: 0
Joined: 5/24/2007
Status: offline
I have an ASP.NET TextBox, and want to catch the KeyPress Event.
The TextBox is TextBox1
The Page is Default.Aspx

In the Page_Load of the Default.Aspx.VB, I have:
TextBox1.Attributes.Add("OnKeyPress", "GetKeyPress(this)")

In the Default.ASPX code, i have:

<Script Type="Text/VB">

Function GetKeyPress()
   MsgBox("you pressed " & event.KeyCode)
End Function

</Script>

But I keep Getting "Object Expected" Error.  I've tried about a thousand varieties of this.  It's pretty basic what i am trying to do, but i can't seem to get it.
Can someone help with this code?
Thanks
 
 
Post #: 1
 
 RE: Going Crazy - TextBox KeyPress Event - 6/22/2007 1:57:32 AM   
  ebgreen


Posts: 4411
Score: 29
Joined: 7/12/2005
Status: offline
I don't do ASP, but here is what I see. This line:

TextBox1.Attributes.Add("OnKeyPress", "GetKeyPress(this)")

Says "Whenever someone presses this key, call the GetKeyPress function and pass an object to it.

This Line:

Function GetKeyPress()

Does not say anything about the function accepting an object.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to bortiquai)
 
 
Post #: 2
 
 RE: Going Crazy - TextBox KeyPress Event - 7/11/2007 1:19:19 PM   
  Rischip


Posts: 346
Score: 2
Joined: 3/26/2007
Status: offline
Give this a shot:

Default.aspx.vb

      

Default.aspx

      

_____________________________

Rischip
Author of - The Grim Linker

(in reply to bortiquai)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP.NET >> Going Crazy - TextBox KeyPress Event Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts