title: How do I convert string to decimal?
body: <p>I have this textbox that accepts numbers, commas, and periods.</p>
  
  <p>Let's say this textbox contains input <code>14,500.00</code></p>
  
  <p>I tried to convert this number to decimal with <code>Convert.ToDecimal(textbox.text)</code> but it's not working. <code>Convert.ToDecimal()</code> to textboxes that contain input that has the format <code>XXXX.DD</code> are converted to decimal but input with format <code>X,XXX.DD</code> or any input with a thousand separator results to error: </p>
  
  <blockquote>
    <p><code>Input string was not in correct format</code></p>
  </blockquote>
  
  <p>Is <code>Convert.ToDecimal()</code> appropriate in this case?</p>
  
  <p>ADDITIONAL INFO:</p>
  
  <p><img src="https://i.stack.imgur.com/KsjbD.jpg" alt="enter image description here"></p>
  
  <p>Here is the form. If I click 'Add', the product of 'Price' and 'Quantity' should be displayed as 'Amount' in the datagridview. </p>
  
  <p>The syntax in the 'Add' button includes:</p>
  
  <pre><code>DataRow dr;
  dr = dsDetail.Tables["SalesOrderDetails"].NewRow();
  dr["Amount"] = Convert.ToDecimal(txtSellingPrice.Text) * Convert.ToDecimal(txtQuantity.Text);
  </code></pre>
  
  <p>The <code>Amount</code> field in my <code>SalesOrderDetails</code> table has the datatype <code>decimal(18,2)</code></p>