C
C#14mo ago
minjiicore

❔ 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?
No description
No description
5 Replies
Thinker
Thinker14mo ago
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.
minjiicore
minjiicoreOP14mo ago
ahh ok any way to set this to .
Thinker
Thinker14mo ago
Yeah, pass CultureInfo.InvariantCulture
minjiicore
minjiicoreOP14mo ago
ah ok thanks
Accord
Accord14mo ago
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.
Want results from more Discord servers?
Add your server