❔ all my inputs are correct and yet they say it is not in a correct format
hi so im new to c# and created a bmi calculator all the inputs are correct but yet they still prompt me saying that there is a input problem can anyone help?
5 Replies
Firstly, use
int.Parse
instead of Convert.ToInt32
Secondly, Convert.ToInt32
uses the decimal separator of the system culture by default, so your system is set to use ,
and not .
.
What you can do is use int.Parse
and pass CultureInfo.InvariantCulture
to it to specify that it should use the invariant culture, which uses .
as the decimal separator.ahh ok
any way to set this to .
Yeah, pass CultureInfo.InvariantCulture
ah ok
thanks
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.