VB .net converting string to decimal

I'm trying convert value passed via text field to decimal and getting an error in doing so. I'm using vb .net trying to process gift certificates using web api. Any suggestions?

Dim bal as decimal

bal = Convert.ToDecimal(txtField.Text)

 

Parents
  • Hi Susan,

    Good day.

    1, you can use a label to check out what is in txtField.

    lblLabel.text="Start"+txtField.text.tostring() +"End"

    2, if it is a user input, you can use RegularExpressionValidator to prevent errors.

    3, if it comes from webapi, you can use substring to cut off unwanted part.

    have fun

    Ben

     

Reply
  • Hi Susan,

    Good day.

    1, you can use a label to check out what is in txtField.

    lblLabel.text="Start"+txtField.text.tostring() +"End"

    2, if it is a user input, you can use RegularExpressionValidator to prevent errors.

    3, if it comes from webapi, you can use substring to cut off unwanted part.

    have fun

    Ben

     

Children