AccessDataSourceDesigner.DataFile Property

Definition

Implements a designer property to shadow the DataFile property of the associated control.

public:
 property System::String ^ DataFile { System::String ^ get(); void set(System::String ^ value); };
public string DataFile { get; set; }
member this.DataFile : string with get, set
Public Property DataFile As String

Property Value

A String that contains the name and path of the data file associated with the AccessDataSource.

Examples

The following code example shows how to use the DataFile property to display the name and path of the Access data file that is associated with the AccessDataSource control in the control placeholder at design time.

This code example is part of a larger example provided for the AccessDataSourceDesigner class.

// Generate design time markup.
public override string GetDesignTimeHtml()
{
    // Generate a design-time placeholder containing the 
    // DataFile and the ConnectionString properties.
    // Split the ConnectionString into segments so it doesn't make
    // placeholder too wide.
    string[] connectParts = GetConnectionString().Split(new char[] { ';' });
    string connectString = "  " + connectParts[0];

    for (int i = 1; i < connectParts.Length; i++)
        connectString += ";<br>  " + connectParts[i].Trim();

    return CreatePlaceHolderDesignTimeHtml(
        "DataFile: " + DataFile + "<br />" +
        "Connection string:<br />" + connectString);
}
' Generate design time markup.
Public Overrides Function GetDesignTimeHtml() As String
    ' Generate a design-time placeholder containing the 
    ' DataFile and the ConnectionString properties.
    ' Split the ConnectionString into segments so it doesn't make
    ' placeholder too wide.
    Dim connectParts() As String
    connectParts = GetConnectionString().Split((";").ToCharArray())
    Dim connectString As String
    connectString = "  " & connectParts(0)

    Dim i As Integer
    For i = 1 To connectParts.Length - 1
        connectString &= ";<br>  " & connectParts(i).Trim()
    Next

    Return CreatePlaceHolderDesignTimeHtml( _
        "DataFile: " & DataFile & "<br />" & _
        "Connection string:<br />" & connectString)
End Function

Remarks

Set the DataFile property in the designer to the name and path of the .mdb file containing the Microsoft Access database to use for the associated AccessDataSource control.

Applies to

See also