Results 1 to 4 of 4

Thread: [RESOLVED] VS 2010 textbox text change

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2012
    Posts
    23

    Resolved [RESOLVED] VS 2010 textbox text change

    Hello a very simple question that I just can't seem to figure out.
    The text change event only fires when I hit enter.
    It doesn't fire every time I enter a character.
    Any help is appreciated!

    Code:
    Protected Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
            MsgBox("test")
     End Sub
    JO

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: VS 2010 textbox text change

    What "enter" will do is validate the textbox, thus run server code.If that would have happened with text change then it would mean that on every key press you would postback to the server so as a side effect your page would load every time you pressed a key.
    What you want is mostly controlled with 2 ways i can think right now.
    1)Use javascript or Jquery to catch the textbox text changing and do something.
    2)Use an html text input element and use one of it's keysomething events to run a js fucntion:
    Code:
     <input id="Text1" type="text"  onkeydown="javasfunction()"  />
    Last edited by sapator; Jan 22nd, 2013 at 01:16 AM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2012
    Posts
    23

    Re: VS 2010 textbox text change

    Thanks for the reply the code you posted worked great

    JO

  4. #4
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: [RESOLVED] VS 2010 textbox text change

    No problem.I suppose you found a js function(?)
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width