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. Visual Basic
  4. Input mask on text box

Input mask on text box

Scheduled Pinned Locked Moved Visual Basic
question
5 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.
  • H Offline
    H Offline
    harveyhanson
    wrote on last edited by
    #1

    Is there are a way to put an input mask or some type of validation on a text box? I either want to stop anything apart from upper and lowercase letters as they are typing in the box or Load an event on a button press if anything except uppercase and lowercase is in the box. Any ideas? Cheers in advance

    K C 2 Replies Last reply
    0
    • H harveyhanson

      Is there are a way to put an input mask or some type of validation on a text box? I either want to stop anything apart from upper and lowercase letters as they are typing in the box or Load an event on a button press if anything except uppercase and lowercase is in the box. Any ideas? Cheers in advance

      K Offline
      K Offline
      Krish KP
      wrote on last edited by
      #2

      can write code to validate the text input in 'key press' event or 'change event' or 'lost focus' event of text box Ex. for key press event (using VB6) if (keyascii >= 65 and keyascii <= 90) and (keyascii >= 97 and keyascii <= 122) then ..... else ..... end if

      Regards KP

      1 Reply Last reply
      0
      • H harveyhanson

        Is there are a way to put an input mask or some type of validation on a text box? I either want to stop anything apart from upper and lowercase letters as they are typing in the box or Load an event on a button press if anything except uppercase and lowercase is in the box. Any ideas? Cheers in advance

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        In VB 2005 you can use a masked edit control. In earlier versions, you have to handle the KeyPress event and set e.Handled to true if the key is one you want to reject.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        H 1 Reply Last reply
        0
        • C Christian Graus

          In VB 2005 you can use a masked edit control. In earlier versions, you have to handle the KeyPress event and set e.Handled to true if the key is one you want to reject.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          H Offline
          H Offline
          harveyhanson
          wrote on last edited by
          #4

          Hi, sorry, forgot to mention, its for VB.NET 2005. How does the mark edit control work? I have looked on MSDN but it doestn really help. I guess its nothing like excel's input mask!?

          C 1 Reply Last reply
          0
          • H harveyhanson

            Hi, sorry, forgot to mention, its for VB.NET 2005. How does the mark edit control work? I have looked on MSDN but it doestn really help. I guess its nothing like excel's input mask!?

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            MSN has full documentation on how to write input masks for the masked input control. I don't really know, I always write my own code.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            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