Need Help !!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajwindersachdeva
    New Member
    • Jan 2007
    • 3

    #1

    Need Help !!!

    I have developed a system using VB but I am facing some problem in displaying my results. The results of calculations performed are being displayed in scientific format inspite of my changing the format of text boxes. For example .09725 is being displayed as 9.725 E-2. I have kept the Max Length to be 100.

    Can someone please help.

    Regards
    Raj
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Try to display cstr(.09725 ).

    Not sure why you get it this way. I couldn't replicate this at all.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by iburyak
      Try to display cstr(.09725 ).

      Not sure why you get it this way. I couldn't replicate this at all.
      It could be related to data type. And the VB version.

      I think I overcame this at one point by using Format(variable ,"Fixed").

      Comment

      • rajwindersachdeva
        New Member
        • Jan 2007
        • 3

        #4
        Originally posted by iburyak
        Try to display cstr(.09725 ).

        Not sure why you get it this way. I couldn't replicate this at all.
        Thanks for replying. I tried as an example cstr(Text 21/ Text 141), but it didnt make any difference. Can u think of something else?

        Regards
        Raj

        Comment

        • rajwindersachdeva
          New Member
          • Jan 2007
          • 3

          #5
          Originally posted by Killer42
          It could be related to data type. And the VB version.

          I think I overcame this at one point by using Format(variable ,"Fixed").
          I am sorry for asking this but I am confused. For example Shall I write this as Format(Text 15/ Text 141, "Fixed")

          Sorry for inconvinience but I have just started learning VB.

          Regards
          Raj

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by rajwindersachde va
            I am sorry for asking this but I am confused. For example Shall I write this as Format(Text 15/ Text 141, "Fixed")
            Sorry for inconvinience but I have just started learning VB.
            You could certainly try it that way, and see what happens.

            Where I included "variable", this could be any expression which evaluates to a number. If you use Text15 / Text141 (I'll assume these are two textbox controls) then VB would use the default property of these controls. In the case of the textbox, the default property is .Text, which is a string. In such a case, I personally would use the Val( ) function to convert each of them to numeric format, but in fact VB is quite forgiving in this area and will probably do that conversion for you.

            I believe that trial and error is a very important part of learning programming. Try everything you can think of. If it doesn't work, at least you know for next time. And once you understand why it didn't work, you'll know something knew. :)

            Comment

            • iburyak
              Recognized Expert Top Contributor
              • Nov 2006
              • 1016

              #7
              I don't think it has anything to do with a text box itself.
              Show me the code on how you do calculations and display result in a textbox, please.

              Comment

              Working...