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. Visual Basic
  4. VB.Net Rounding Numbers

VB.Net Rounding Numbers

Scheduled Pinned Locked Moved Visual Basic
csharphelp
7 Posts 3 Posters 1 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.
  • D Offline
    D Offline
    Desi Bravo
    wrote on last edited by
    #1

    I created a BMI program. I am having a problem with rounding numbers. I tried the Double, Constant, and Short. But it still results long numbers. Can anyone he:)lp me. bravo659

    C 1 Reply Last reply
    0
    • D Desi Bravo

      I created a BMI program. I am having a problem with rounding numbers. I tried the Double, Constant, and Short. But it still results long numbers. Can anyone he:)lp me. bravo659

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I recently converted a project from VB.NET to C# and discovered that VB.NET has some very entertaining ideas about number rounding. I think though that you're saying you want to control how many digits a floating point number has to the right of the point ? The .Format method will do that for you. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

      D M 2 Replies Last reply
      0
      • C Christian Graus

        I recently converted a project from VB.NET to C# and discovered that VB.NET has some very entertaining ideas about number rounding. I think though that you're saying you want to control how many digits a floating point number has to the right of the point ? The .Format method will do that for you. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

        D Offline
        D Offline
        Desi Bravo
        wrote on last edited by
        #3

        Thannk you for youre reply to my inquiry. I will try it and let you know how it went. bravo659

        1 Reply Last reply
        0
        • C Christian Graus

          I recently converted a project from VB.NET to C# and discovered that VB.NET has some very entertaining ideas about number rounding. I think though that you're saying you want to control how many digits a floating point number has to the right of the point ? The .Format method will do that for you. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

          M Offline
          M Offline
          MyThread
          wrote on last edited by
          #4

          I have question, not related to the problem, but you mentioned in your reply that you are converting a program from VB.Net to C#. Can you please tell me why you made that decision. I am working on this web application using VB.Net. I was thinking about converting to C# but still can't make a decision. What could be the advantages since both are now Object-Oriented. Thanks for you reply.

          C D 2 Replies Last reply
          0
          • M MyThread

            I have question, not related to the problem, but you mentioned in your reply that you are converting a program from VB.Net to C#. Can you please tell me why you made that decision. I am working on this web application using VB.Net. I was thinking about converting to C# but still can't make a decision. What could be the advantages since both are now Object-Oriented. Thanks for you reply.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            I had to use VB.NET for an ASP.NET job, and I found it to be even worse than I imagined. Yes, both are OO, and both compile to MSIL, however, VB.NET is incredibly ugly, and has some 'features' that are plain astounding. For example, a function will return false, Nothing or 0 ( depending on the return type ) by default. A blank string is the same as Nothing, if you compare them. I was so disgusted that I started a couple of threads on it, and some of the comments I got from people with a background in VB6 included that VB.NET was initially a good design, until all the VB6 users complained about things that had (rightly) been removed. Now, VB.NET adds a lot of syntax to make it possible to use it in a clean way, but very few users know about it, they keep using things like CType and IIf. Another user informed me that the C# MSIL compiler generates more efficient ( i.e. faster ) code. Another told me that any VB6 programmer who was worth anything had moved to C# because of the mess they had to make of VB.NET to keep the legacy coders happy. In the end, it's obvious that VB.NET is a dead duck. Unlike VB.NET, C# is a new language, designed to be OO, designed to be clean, designed to be a serious language. VB was designed for beginners, and VB.NET carries it's legacy. I don't see why Microsoft need two proprietary languages, and C# is obviously the one they are putting their efforts in to. The gap between C# and VB.NET will grow until VB.NET can be dropped with nary a cry of complaint. If more reason is needed, just compare how many people are answering C# questions/writing C# articles compared to VB.NET here on CP. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

            M 1 Reply Last reply
            0
            • C Christian Graus

              I had to use VB.NET for an ASP.NET job, and I found it to be even worse than I imagined. Yes, both are OO, and both compile to MSIL, however, VB.NET is incredibly ugly, and has some 'features' that are plain astounding. For example, a function will return false, Nothing or 0 ( depending on the return type ) by default. A blank string is the same as Nothing, if you compare them. I was so disgusted that I started a couple of threads on it, and some of the comments I got from people with a background in VB6 included that VB.NET was initially a good design, until all the VB6 users complained about things that had (rightly) been removed. Now, VB.NET adds a lot of syntax to make it possible to use it in a clean way, but very few users know about it, they keep using things like CType and IIf. Another user informed me that the C# MSIL compiler generates more efficient ( i.e. faster ) code. Another told me that any VB6 programmer who was worth anything had moved to C# because of the mess they had to make of VB.NET to keep the legacy coders happy. In the end, it's obvious that VB.NET is a dead duck. Unlike VB.NET, C# is a new language, designed to be OO, designed to be clean, designed to be a serious language. VB was designed for beginners, and VB.NET carries it's legacy. I don't see why Microsoft need two proprietary languages, and C# is obviously the one they are putting their efforts in to. The gap between C# and VB.NET will grow until VB.NET can be dropped with nary a cry of complaint. If more reason is needed, just compare how many people are answering C# questions/writing C# articles compared to VB.NET here on CP. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer

              M Offline
              M Offline
              MyThread
              wrote on last edited by
              #6

              Thanks Chritian. You are right, even for the .net job openings, people ask for C# and not VB.Net.

              1 Reply Last reply
              0
              • M MyThread

                I have question, not related to the problem, but you mentioned in your reply that you are converting a program from VB.Net to C#. Can you please tell me why you made that decision. I am working on this web application using VB.Net. I was thinking about converting to C# but still can't make a decision. What could be the advantages since both are now Object-Oriented. Thanks for you reply.

                D Offline
                D Offline
                Desi Bravo
                wrote on last edited by
                #7

                I found the answer, i am using Math.Round to round off the numbers n the BMI project. bravo659

                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