fix crash when entering non digits in the input fields

This commit is contained in:
Ilya 2020-05-05 12:13:28 +03:00
parent 211c0e834f
commit 0f05ce77d3
3 changed files with 9 additions and 11 deletions

View File

@ -36,19 +36,14 @@ namespace PhysFormuler
{ {
if (box.Text != "") if (box.Text != "")
{ {
if (Convert.ToDouble(box.Text) != 0) double number;
if (Double.TryParse(box.Text,out number))
{ {
return true; return !double.IsNaN(number);
} }
else else return false;
{
return false;
}
}
else
{
return false;
} }
else return false;
} }
private void Update(string type) private void Update(string type)

View File

@ -10,4 +10,7 @@
<FallbackCulture>ru-RU</FallbackCulture> <FallbackCulture>ru-RU</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles> <VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
</Project> </Project>