CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    Multipling numbers with a DECIMAL POINT

    Im tring to create a simple aplication that transforms measurements from the us sytem to the metric system. My problem is that the program doesnt seem to recognise comas ( decimal points; eg 17.5 is seen by the program as 175 ) Im using a text box to let the user put in the numbers and a comand buton to perform the equation eg:

    Private Sub Command1_Click()
    Text1.Text = Text1.Text * 2
    End Sub


    if you wirgt 1.5 in the texbox

    the result will be 30 insted of 3

    please help!



  2. #2
    Guest

    Re: Multipling numbers with a DECIMAL POINT

    use val(text1.text) or use csng(text1.text)


  3. #3
    Join Date
    Dec 1999
    Location
    Tel Aviv, Israel, Earth, Solar System
    Posts
    50

    Re: Multipling numbers with a DECIMAL POINT

    You might wish to use variables of certain types,
    like

    Dim Num as Double
    Dim Result as Double

    private Sub Command1_Click()
    Num = Val(Text1.Text)
    Result = Num * 2
    Debug.print Result
    End Sub





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured