private static extern int _controlfp(int n, int mask);
private const int _MCW_EW = 0x8001F;
private const int _EM_INVALID = 0x10;
Now call this function at the start of your form constructor
Now call this function at the start of your form constructor
{
Regex reg=
new Regex(@"\D"); return !reg.Match(text).Success;}
Here if text contains only digits then the result of reg.Match is false, so Validate will return true and vice versa. Here decimal point is also considered as non digit and will cause the result of the function to be false.
Now the following code snippet will recognize the period "." as the part of the digits also but more than one periods will not cause error i.e 123.45.67 will also return true.
bool
Validate(string text){
Regex reg=
new Regex(@"[^0-9.]"); return !reg.Match(text).Success;}
private
void RemovesWebServiceExtension(string extensionPath){
try
{
object ext = this.GetIISObject("IIS://" + Environment.MachineName+"/W3SVC");
object[] args=new object[1]{extensionPath};
LateBinding.LateCall(ext, null, "DeleteExtensionFileRecord", args, null, null);
}
catch
{
throw;
}
}
private object GetIISObject(string fullObjectPath)
{
try
{
return RuntimeHelpers.GetObjectValue(Interaction.GetObject(fullObjectPath, null));
}
catch
{
throw;
}
}
//If it is a new row that has just been added but not attached to data grid, then ends its editing.
if(dr.RowState == DataRowState.Detached ) this.BindingContext[this.grid.DataSource, this.grid.DataMember].EndCurrentEdit();public
override bool Equals(object obj){
PropertyInfo [] properties=
this.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach( PropertyInfo property in properties ){
object obj1=property.GetValue(this, null), obj2=property.GetValue(obj, null); if( (obj1==null && obj2!=null) || (obj1!=null && obj2==null) ||((obj1!=
null && obj2!=null) && !obj1.Equals(obj2))) return false;}
return true;}
public override int GetHashCode(){
return base.GetHashCode ();}
{
if(parent==null) return;FieldInfo [] fields;
if(parent.GetType()==this.GetType().BaseType)fields=parent.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
elsefields=
this.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach(FieldInfo field in fields){
object val=field.GetValue(parent);field.SetValue(
this, val);}
}