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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Numeric Text Box Formatting

Numeric Text Box Formatting

Scheduled Pinned Locked Moved C#
databasesql-serversysadminquestion
4 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.
  • S Offline
    S Offline
    StyleGuide
    wrote on last edited by
    #1

    Hi All, A Text Box on a Form of mine is bound to a Numeric SQL Server field. Is there any easy way to Format the contents to : '9.00', and Not '9.0000' as it is at the moment? [I Bind in code so was thinking I could include formatting there] Thanks Jonny

    S 1 Reply Last reply
    0
    • S StyleGuide

      Hi All, A Text Box on a Form of mine is bound to a Numeric SQL Server field. Is there any easy way to Format the contents to : '9.00', and Not '9.0000' as it is at the moment? [I Bind in code so was thinking I could include formatting there] Thanks Jonny

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      Take a look at this MSDN topic covering Numeric Format Strings[^]. There may also be a way doing the formatting during data binding. I remember doing something like that on my website. But to help you specifically with that some code would be helpful.


      www.troschuetz.de

      S 1 Reply Last reply
      0
      • S Stefan Troschuetz

        Take a look at this MSDN topic covering Numeric Format Strings[^]. There may also be a way doing the formatting during data binding. I remember doing something like that on my website. But to help you specifically with that some code would be helpful.


        www.troschuetz.de

        S Offline
        S Offline
        StyleGuide
        wrote on last edited by
        #3

        Thanks Stefan, Heres the code : this.textBoxAmount.DataBindings.Add("Text", myBindingSource, "Amount") There is another .Add Constructor, which includes 'formatString', so perhaps I can use that? Thanks Jonny

        S 1 Reply Last reply
        0
        • S StyleGuide

          Thanks Stefan, Heres the code : this.textBoxAmount.DataBindings.Add("Text", myBindingSource, "Amount") There is another .Add Constructor, which includes 'formatString', so perhaps I can use that? Thanks Jonny

          S Offline
          S Offline
          Stefan Troschuetz
          wrote on last edited by
          #4

          Yes, that sounds like the one you're looking for.


          www.troschuetz.de

          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