Code
1: Use a regular expression
/// Determine whether a string is a valid integer (no length limit)
/// </Summary>
/// <Param name = "S"> string </param>
/// <Returns> </returns>
Public static bool isinteger (string S)
{
String Pattern = @ "^ \ D * $ ";
Return RegEx. ismatch (S, pattern );
}
2: Call a function
If (isnumber(this.txt rotateangle. Text. Trim ()))
Dangle = (convert.toint32(this.txt rotateangle. Text) % 360 );
Else
Dangle = 0;
Private bool isnumber (string S)
{
Int flag = 0;
Char [] STR = S. tochararray ();
For (INT I = 0; I <Str. length; I ++)
{
If (char. isnumber (STR [I])
{
Flag ++;
}
Else
{
Flag =-1;
Break;
}
}
If (flag> 0)
{
Return true;
}
Else
{
Return false;
}
}
3:
The boss asked me to call conversion.val(this.txt rotateangle. Text) in VB );
However, you must first add using Microsoft. VisualBasic;
For example, the "isdate" and "isnumeric" functions only exist in VB. NET,
For example, to rename a file name in C #, you must use the file. Move (); method. However, if the file is large, it will be troublesome.
In VB. NET, you can directly call Rename (oldpath, newpath) to easily rename disk files, directories, or files.