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. Windows Forms
  4. How to Block Keyboard Keys in a textbox .. ?

How to Block Keyboard Keys in a textbox .. ?

Scheduled Pinned Locked Moved Windows Forms
tutorialquestion
7 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.
  • S Offline
    S Offline
    SamRST
    wrote on last edited by
    #1

    hi friends, How to Block keyboard key in value to TextBox but barcode scanner still can use..? Thanks in Advance. Cheers

    K C 2 Replies Last reply
    0
    • S SamRST

      hi friends, How to Block keyboard key in value to TextBox but barcode scanner still can use..? Thanks in Advance. Cheers

      K Offline
      K Offline
      Kristian Sixhoj
      wrote on last edited by
      #2

      textBox.ReadOnly = true;

      This way the user won't be able to type text in the textbox, but you can still change the text in the code behind:

      textBox.Text = "Hello World!";

      I don't know if this can be used with a barcode scanner, but give it a try.

      Kristian Sixhoej


      "Failure is not an option" - Gene Kranz

      S 1 Reply Last reply
      0
      • S SamRST

        hi friends, How to Block keyboard key in value to TextBox but barcode scanner still can use..? Thanks in Advance. Cheers

        C Offline
        C Offline
        ChandraRam
        wrote on last edited by
        #3

        SamRST wrote:

        hi friends, How to Block keyboard key in value to TextBox but barcode scanner still can use..? Thanks in Advance.

        If your barcode scanner is a keyboard wedge, I don't think you can do this.

        S 1 Reply Last reply
        0
        • C ChandraRam

          SamRST wrote:

          hi friends, How to Block keyboard key in value to TextBox but barcode scanner still can use..? Thanks in Advance.

          If your barcode scanner is a keyboard wedge, I don't think you can do this.

          S Offline
          S Offline
          SamRST
          wrote on last edited by
          #4

          My scanner is not a keboard wedge. its a USB scanner.

          C 1 Reply Last reply
          0
          • K Kristian Sixhoj

            textBox.ReadOnly = true;

            This way the user won't be able to type text in the textbox, but you can still change the text in the code behind:

            textBox.Text = "Hello World!";

            I don't know if this can be used with a barcode scanner, but give it a try.

            Kristian Sixhoej


            "Failure is not an option" - Gene Kranz

            S Offline
            S Offline
            SamRST
            wrote on last edited by
            #5

            i already tested that. by tat , v cannot scan in textbox using a scanner.

            1 Reply Last reply
            0
            • S SamRST

              My scanner is not a keboard wedge. its a USB scanner.

              C Offline
              C Offline
              ChandraRam
              wrote on last edited by
              #6

              By keyboard wedge, I meant that your bar code scanner functions like a keyboard... Looking at your answer to the other poster, it looks like your scanner _is_ a keyboard wedge, in which case you cannot do what you wanted to in your OP.

              S 1 Reply Last reply
              0
              • C ChandraRam

                By keyboard wedge, I meant that your bar code scanner functions like a keyboard... Looking at your answer to the other poster, it looks like your scanner _is_ a keyboard wedge, in which case you cannot do what you wanted to in your OP.

                S Offline
                S Offline
                SamRST
                wrote on last edited by
                #7

                Thanks for your reply.. Cheers.

                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