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. default textbox value

default textbox value

Scheduled Pinned Locked Moved C#
csharptutorial
5 Posts 4 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.
  • V Offline
    V Offline
    vins21
    wrote on last edited by
    #1

    How to set default textbox value in C#.net

    P S 2 Replies Last reply
    0
    • V vins21

      How to set default textbox value in C#.net

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      What do you mean by the default textbox value? If it's just a value when the form displays, simply set the Text property as in userName.Text = "No user";. Is it something more complicated that you are after?

      *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

      "Mind bleach! Send me mind bleach!" - Nagy Vilmos

      CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

      V 1 Reply Last reply
      0
      • P Pete OHanlon

        What do you mean by the default textbox value? If it's just a value when the form displays, simply set the Text property as in userName.Text = "No user";. Is it something more complicated that you are after?

        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

        V Offline
        V Offline
        vins21
        wrote on last edited by
        #3

        sir, i'm using textbox in my project having calculating some value. Noe if user hv'nt entered any value, then I wish to set default value as "0". plz suggest me something.

        L 1 Reply Last reply
        0
        • V vins21

          sir, i'm using textbox in my project having calculating some value. Noe if user hv'nt entered any value, then I wish to set default value as "0". plz suggest me something.

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

          Check if the user entered a value when the textbox looses focus. If not, set aforementioned property to '0'. If this sounds "complex", then you probably want to spend some time at the library with a good book on the subject.

          Bastard Programmer from Hell :suss:

          1 Reply Last reply
          0
          • V vins21

            How to set default textbox value in C#.net

            S Offline
            S Offline
            Sunil P V
            wrote on last edited by
            #5

            Use the Properties window to set the 'Text' property to 0. This could be set as default when your form initializes. When the textbox loses focus add a validation. This should suffice. Alternatively I suppose you can set the text box to accept numbers only.

            Sunil

            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