Validation With Regular Expression
Posted: Mon Feb 08, 2010 11:17 pm
I have a script that validates the correct default directory is displayed when the user saves an image using the application. The default directory should be:
C:\Documents and Settings\James\My Documents\System Manager
However, the username, in this case 'James' will change depending on what system the script is executed on. I tried to work around this problem by using a regular expression, but I cannot get my code to compile. Ranorex is showing the following error:
An object reference is required for the non-static field, method, or property 'ADSIasUserDefaultFileDir.SMImages.path' (CS0120)
Below is my code. Any help on this topic is greatly appreciated.
public partial class SMImages
{
public static string str = @"C:\Documents and Settings\*.*\My Documents\System
Manager";
Regex path = new Regex(str);
static SMImages()
{
//Your recording specific initialization code goes here.
}
public static void Validate_TextC__Documents_and_Setting1()
{
//Your code here. Code inside this method will not be changed by the code
generator.
Validate.Attribute (repo.FormSave_Image.TextC__Documents_and_SettingInfo, "AccessibleValue", path);
}
}
C:\Documents and Settings\James\My Documents\System Manager
However, the username, in this case 'James' will change depending on what system the script is executed on. I tried to work around this problem by using a regular expression, but I cannot get my code to compile. Ranorex is showing the following error:
An object reference is required for the non-static field, method, or property 'ADSIasUserDefaultFileDir.SMImages.path' (CS0120)
Below is my code. Any help on this topic is greatly appreciated.
public partial class SMImages
{
public static string str = @"C:\Documents and Settings\*.*\My Documents\System
Manager";
Regex path = new Regex(str);
static SMImages()
{
//Your recording specific initialization code goes here.
}
public static void Validate_TextC__Documents_and_Setting1()
{
//Your code here. Code inside this method will not be changed by the code
generator.
Validate.Attribute (repo.FormSave_Image.TextC__Documents_and_SettingInfo, "AccessibleValue", path);
}
}