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. use only 2 digis in simple precision

use only 2 digis in simple precision

Scheduled Pinned Locked Moved C#
question
4 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.
  • N Offline
    N Offline
    naghoumeh14
    wrote on last edited by
    #1

    suppose a float f and if i am intrested only in using this float but having only 2 digits after the dot so what i want to do is to delete the remaining digits .. so how do i do this?

    D 1 Reply Last reply
    0
    • N naghoumeh14

      suppose a float f and if i am intrested only in using this float but having only 2 digits after the dot so what i want to do is to delete the remaining digits .. so how do i do this?

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #2
      1. You could use Math.Round(number,2); 2) You could use the decimal type 3) If the number is in a textbox replace it with numericUpDown and specify the number of digits
      L 1 Reply Last reply
      0
      • D Dan Mos
        1. You could use Math.Round(number,2); 2) You could use the decimal type 3) If the number is in a textbox replace it with numericUpDown and specify the number of digits
        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        MDL=>Moshu wrote:

        If the number is in a textbox replace it with numericUpDown and specify the number of digits

        one can paste anything into a editable Control, so that won't cut it. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
        All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.


        D 1 Reply Last reply
        0
        • L Luc Pattyn

          MDL=>Moshu wrote:

          If the number is in a textbox replace it with numericUpDown and specify the number of digits

          one can paste anything into a editable Control, so that won't cut it. :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
          All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.


          D Offline
          D Offline
          Dan Mos
          wrote on last edited by
          #4

          true. But my understanding of the question was "how to use just 2 digits" and not "how to force just 2 digit number in a control". Anyway, as usual good point :)

          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