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. .NET (Core and Framework)
  4. Accepting a rejected character in a Masked Textbox

Accepting a rejected character in a Masked Textbox

Scheduled Pinned Locked Moved .NET (Core and Framework)
tutorialquestion
2 Posts 2 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.
  • G Offline
    G Offline
    gmhanna
    wrote on last edited by
    #1

    Hi, I'm trying to figure out how to accept a rejected character in a masked text box. I am using a "Masked Textbox" for the person's last name and to ensure all alpha characters, I'm using "L?????????????????", however if the person's last name has a quote in it, the masked text box is rejecting it but in code I want to accept it. I see I can where I can check the character in the Reject event, however I can not cancel the reject. Any suggestions how to do this, other than using a Keydown event and accepting only the characters I want? Thank you,

    Glenn

    L 1 Reply Last reply
    0
    • G gmhanna

      Hi, I'm trying to figure out how to accept a rejected character in a masked text box. I am using a "Masked Textbox" for the person's last name and to ensure all alpha characters, I'm using "L?????????????????", however if the person's last name has a quote in it, the masked text box is rejecting it but in code I want to accept it. I see I can where I can check the character in the Reject event, however I can not cancel the reject. Any suggestions how to do this, other than using a Keydown event and accepting only the characters I want? Thank you,

      Glenn

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      If you want to allow single quote or double quote then use C instead of ?. It will allow any printable character. http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx[^] Otherwise, you need to do validation/restriction on last name manually. Either by tracking lost focus event or likewise.. Hope this will help!

      Jinal Desai - LIVE Experience is mother of sage....

      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