fix crash when entering non digits in the input fields
This commit is contained in:
parent
211c0e834f
commit
0f05ce77d3
Binary file not shown.
@ -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
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
else return false;
|
||||||
}
|
}
|
||||||
else
|
else return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update(string type)
|
private void Update(string type)
|
||||||
@ -101,7 +96,7 @@ namespace PhysFormuler
|
|||||||
if(IsReady(U, type))
|
if(IsReady(U, type))
|
||||||
{
|
{
|
||||||
Numbers.I = Numbers.U / Numbers.R;
|
Numbers.I = Numbers.U / Numbers.R;
|
||||||
I.Text = Math.Round(Numbers.I, 4).ToString();
|
I.Text = Math.Round(Numbers.I, 4).ToString();
|
||||||
}
|
}
|
||||||
if(IsReady(I, type))
|
if(IsReady(I, type))
|
||||||
{
|
{
|
||||||
|
@ -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>
|
Reference in New Issue
Block a user