okay so I'm really confused about this problem and I don't know how to fix it. this is the code and I cant see what I did wrong:
private void btnFormule_Click(object sender, EventArgs e)
{
double NumberA;
NumberA = double.Parse(txtA.Text);
}
it also does the same if I do convert.todouble(). But the weird thing is a while ago it didn't give an error when I did it like this so I don't know what's going on.
When I try it out it gives the error "System.FormatException: The format of the input string is incorrect" (its translated so it's not the exact error). if anyone has a solution to this problem it would really help
double.TryParseinstead ofdouble.Parsesince not every string could be converted to a double, also you should take care about the current culture when parsing see heredouble.Parse()you'll get a FormatException if the string you're passing does not represent a valid formatdouble.Parse(string s, IFormatProvider provider)Convertclass and just wrap it intotry/catchso function from it you need would beConvert.ToDouble(object)double.Parse. It fails exactly the same way if the format is wrong. It accepts a CultureInfo too.