How to extract only interger value from a double value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sprahalad
    New Member
    • Feb 2010
    • 12

    How to extract only interger value from a double value

    Hi all, I have a textbox1 with value 1001.75 and want to move value into next textbox2 only 1001 and no decimals and don't want to round as well. Please help me becasue I tried this in many ways.
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    Use the CStr(somevalue) to move the whole number into a string. Then use left(somestring , instr(1, somestring, ".") - 1) to move it into the other text box...



    Good Luck

    Comment

    • Guido Geurs
      Recognized Expert Contributor
      • Oct 2009
      • 767

      #3
      dear,

      I hope this will help:
      Code:
      Private Sub Command1_Click()
         Text2.Text = Int(Val(Text1.Text))
      End Sub
      see attachment

      br,
      Attached Files

      Comment

      • sprahalad
        New Member
        • Feb 2010
        • 12

        #4
        Thanks for your help......it worked

        Comment

        • sprahalad
          New Member
          • Feb 2010
          • 12

          #5
          Thanks for your help......

          Comment

          • sprahalad
            New Member
            • Feb 2010
            • 12

            #6
            This is great actually and it worked......... ..thanks for your help..

            Comment

            Working...