Hello,
I am trying to use a TryParse as a validation for a float in a windows form temperature converter web app. I am getting the error No overload for method 'TryParse' takes 1 arguments.
The error shows here (float.TryParse(txtInitialTemp.Text)) and I am guessing this means that I am missing something?
Could someone please explain how to use TryParse with a float?
Thank you:).
public float inputMethod() // this is the method for calculating the conversion OBTAIN initialTemp and OBTAIN Conversion type
{
float temp;
if (float.TryParse(txtInitialTemp.Text))// get initial temp (converts string representation of number to float)
{
return temp;
}
else //if something other than a number entered
{
txtInitialTemp.Clear();
MessageBox.Show("Please enter a number in the account number section ");
}
}