Mfwamba Tshimanga

Mfwamba Tshimanga

  • NA
  • 155
  • 46k

How make it decimal and how to stop the error message

Jul 1 2014 10:48 AM
Hi!
I do write this code. But I would like to see the number I enter in the textbox be decimal. How can I do it please.
Other point strange, when I am trying to delete my textbox that should make operation. When the last number is deleted I receive a error message:
Input string was not in a correct format. 
 
private void quantidadeFactu_KeyUp(object sender, KeyEventArgs e)
{
float quantidadeFact;
float precoFact;
float totFact;
quantidadeFact = Convert.ToInt32(quantidadeFactu.Text);//for example in this quantitity textbox when I delete until the latest number. The error message appear.
precoFact = Convert.ToInt32(precosaidaFactu.Text);
totFact = quantidadeFact * precoFact;
totalFactu.Text = totFact.ToString();
}
 

Answers (6)