ResXResourceReader::BasePath Property

 

Gets or sets the base path for the relative file path specified in a ResXFileRef object.

Namespace:   System.Resources
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public:
property String^ BasePath {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

A path that, if prepended to the relative file path specified in a ResXFileRef object, yields an absolute path to a resource file.

Exception Condition
InvalidOperationException

In a set operation, a value cannot be specified because the XML resource file has already been accessed and is in use.

The BasePath property is used to resolve relative file path references that are assigned to the FileName property of ResXFileRef objects. By default, its value is String::Empty, and relative file path references are resolved in relationship to the current directory returned by the Environment::CurrentDirectory property. You should set this property before you begin enumerating resources.

The following example creates an XML resource file that contains images of dog breeds, and also creates a string resource that specifies the application that created the resource. ResXFileRef objects are used to store the path to the images rather than storing the binary images themselves in the resource file. The example sets the BasePath property so that the relative file paths in the images' file names are interpreted as subdirectories of a directory named C:\data\.

No code example is currently available or this language may not be supported.

Note that you must add a reference to System.Drawing.dll to compile the project successfully. The example also requires that the necessary images exist in a directory named C:\data\images\.

.NET Framework
Available since 2.0
Return to top
Show: