# Binding C1Editor to a Document

Learn how to bind C1Editor control to a  specific document with the help of Document property.

## Content



You can bind the [C1Editor](/componentone/api/win/online-richtexteditor/dotnet-framework-api/C1.Win.C1Editor.4.8/C1.Win.C1Editor.C1Editor.html) control to a document specified in the [Document](/componentone/api/win/online-richtexteditor/dotnet-framework-api/C1.Win.C1Editor.4.8/C1.Win.C1Editor.C1Editor.Document.html) property. If the document is edited within the C1Editor, the underlying XmlDocument syncs to match it. If the XmlDocument changes in code, these changes are visible in the C1Editor control at run time.

1.  In Visual Studio, click the **View** menu and select **Code** to switch to **Source** view, if necessary.
2.  Add the following statements to your project.
    
    DOC-DETAILS-TAG-OPEN
    
    DOC-SUMMARY-TAG-OPEN
    
    To write code in Visual Basic
    
    DOC-SUMMARY-TAG-CLOSE
    
    ```vbnet
    Imports C1.Win.C1Editor
    Imports System.Xml
    ```
    
    DOC-DETAILS-TAG-CLOSE
    
    DOC-DETAILS-TAG-OPEN
    
    DOC-SUMMARY-TAG-OPEN
    
    To write code in C#
    
    DOC-SUMMARY-TAG-CLOSE
    
    ```csharp
    using C1.Win.C1Editor;
    using System.Xml;
    ```
    
    DOC-DETAILS-TAG-CLOSE
    
3.  Add the following code to the **Page\_Load** event to set the Document property.
    
    DOC-DETAILS-TAG-OPEN
    
    DOC-SUMMARY-TAG-OPEN
    
    To write code in Visual Basic
    
    DOC-SUMMARY-TAG-CLOSE
    
    ```vbnet
    Dim myDoc as new XmlDocument()
    C1Editor1.Document = myDoc
    ```
    
    DOC-DETAILS-TAG-CLOSE
    
    DOC-DETAILS-TAG-OPEN
    
    DOC-SUMMARY-TAG-OPEN
    
    To write code in C#
    
    DOC-SUMMARY-TAG-CLOSE
    
    ```csharp
    XmlDocument myDoc = new XmlDocument(); 
    c1Editor1.Document = myDoc;
    ```
    
    DOC-DETAILS-TAG-CLOSE