Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. VALIDATING TEXT BOX DOES NOT WORK

VALIDATING TEXT BOX DOES NOT WORK

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maheshfour
    wrote on last edited by
    #1

    hi all i am trying to validate a text box entry. i want to enter hex data in the text box. so in the keyDown event of the textbox if the user presses an invalid key i say e.Handled=true. but still the keypressed appears in the text box. private void textBox1_KeyDown(object sender,System.Windows.Forms.KeyEventArgs e) { if(e.KeyValue==65) { e.Handled=true; } } this was the sample code i was trying to disable typing of 'a' can any one help me????

    D 1 Reply Last reply
    0
    • M maheshfour

      hi all i am trying to validate a text box entry. i want to enter hex data in the text box. so in the keyDown event of the textbox if the user presses an invalid key i say e.Handled=true. but still the keypressed appears in the text box. private void textBox1_KeyDown(object sender,System.Windows.Forms.KeyEventArgs e) { if(e.KeyValue==65) { e.Handled=true; } } this was the sample code i was trying to disable typing of 'a' can any one help me????

      D Offline
      D Offline
      Darryl Borden
      wrote on last edited by
      #2

      Key off of the KeyPress event rather than the KeyDown event. Darryl Borden Principal IT Analyst dborden@eprod.com

      A 1 Reply Last reply
      0
      • D Darryl Borden

        Key off of the KeyPress event rather than the KeyDown event. Darryl Borden Principal IT Analyst dborden@eprod.com

        A Offline
        A Offline
        ameto
        wrote on last edited by
        #3

        what is the key off event?

        D 1 Reply Last reply
        0
        • A ameto

          what is the key off event?

          D Offline
          D Offline
          Darryl Borden
          wrote on last edited by
          #4

          There is no "key off" event. Use the "KeyPress" event - not the "KeyDown" event Darryl Borden Principal IT Analyst dborden@eprod.com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups