Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. Windows. forms;
Using devcomponents. dotnetbar. controls;
Namespace windrilling. errorjudge. Class
{
Class clstxtoperate
{
# Region textboxx control can only input numeric Functions
// Only numeric functions can be input
Public static void inputnumonly (textboxx mychecnktxt, keypresseventargs E)
{
// Determine whether the key type is required.
If (INT) E. keychar <48 | (INT) E. keychar> 57) & (INT) E. keychar! = 8 & (INT) E. keychar! = 46)
E. Handled = true;
// Decimal point processing.
If (INT) E. keychar = 46) // decimal point
{
If (mychecnktxt. Text. Length <= 0)
E. Handled = true; // the decimal point cannot be the first.
Else
{
Float F;
Float oldf;
Bool b1 = false, b2 = false;
B1 = float. tryparse (mychecnktxt. Text, out oldf );
B2 = float. tryparse (mychecnktxt. Text + E. keychar. tostring (), Out F );
If (b2 = false)
{
If (b1 = true)
E. Handled = true;
Else
E. Handled = false;
}
}
}
}
# Endregion
}
}