Editor for WinForms | ComponentOne
Editor for WinForms Task-Based Help / Binding C1Editor to a Document
In This Topic
    Binding C1Editor to a Document
    In This Topic

    You can bind the C1Editor control to a document specified in the Document 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.

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Imports C1.Win.C1Editor
      Imports System.Xml
      

      To write code in C#

      C#
      Copy Code
      using C1.Win.C1Editor;
      using System.Xml;
      
    3. Add the following code to the Page_Load event to set the Document property.

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Dim myDoc as new XmlDocument()
      C1Editor1.Document = myDoc
      

      To write code in C#

      C#
      Copy Code
      XmlDocument myDoc = new XmlDocument(); 
      c1Editor1.Document = myDoc;