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. Pls help! how to prevent user to delete prefix value in my texbox

Pls help! how to prevent user to delete prefix value in my texbox

Scheduled Pinned Locked Moved C#
helptutorial
3 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.
  • C Offline
    C Offline
    crisjala
    wrote on last edited by
    #1

    i want that my prefix or my first 4 char value in my textbox which is "SPR-" cannot be deleted or modify by the user...how to code that.. plz.

    L OriginalGriffO 2 Replies Last reply
    0
    • C crisjala

      i want that my prefix or my first 4 char value in my textbox which is "SPR-" cannot be deleted or modify by the user...how to code that.. plz.

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

      One would assume that you are going to do “something” with the contents of the TextBox after the user has finished entering data into it; in which case, if the data does not have an “SPR-“ prefix, add it after the fact.

      1 Reply Last reply
      0
      • C crisjala

        i want that my prefix or my first 4 char value in my textbox which is "SPR-" cannot be deleted or modify by the user...how to code that.. plz.

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        Use a MaskedTextBox[^] instead, and set the mask to "SPR-&&&&&&&&&&&" where the number of '&' characters equals the max length of the input. You can remove the underscore by setting the PromptChar property to space.

        Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        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