locked
Math.Round Method RRS feed

  • Question

  • Hi,

    I'm Bella. I want to ask why I can't round off my answer. The figure below shows the error I got. Can someone explain about it?

    Regards,

    Bella


    • Edited by Bella67 Monday, August 28, 2017 6:43 AM
    Monday, August 28, 2017 6:41 AM

Answers

  • Put in top of your code option strict on and you see it yourself

    Success
    Cor

    • Marked as answer by Bella67 Monday, August 28, 2017 9:27 AM
    Monday, August 28, 2017 8:00 AM

All replies

  • Put in top of your code option strict on and you see it yourself

    Success
    Cor

    • Marked as answer by Bella67 Monday, August 28, 2017 9:27 AM
    Monday, August 28, 2017 8:00 AM
  • Put in top of your code option strict on and you see it yourself

    Success
    Cor

    I got it! Thanks!
    Monday, August 28, 2017 9:27 AM
  • Hi Bella67,

    According to your picture, I find that you want to use Math.Sqrt(Textbox1.Text), from this link ,

    https://msdn.microsoft.com/en-us/library/system.math.sqrt%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

    we can see that Math.Sqrt method is require Double value type, but the TextBox1.Text is string value type, so you need to convert to Double or decimal.

     Dim value As Double
            value = Convert.ToDouble(TextBox1.Text)

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 28, 2017 9:32 AM