Table of Contents

Property Source

Namespace
Alternet.FormDesigner.WinForms
Assembly
Alternet.FormDesigner.v9.dll

Source

Gets or sets FormDesigner Source.

[Browsable(false)]
public IFormDesignerDataSource Source { get; set; }

Property Value

IFormDesignerDataSource

Examples

Here is how to use a Source in the C# code:

using Alternet.FormDesigner.WinForms;

public partial class Form1 : Form
{
    private void Form1_Load(object sender, EventArgs e)
    {
        var formDesigner = new FormDesignerControl();
        formDesigner.AutoSaveToSource = false;
        formDesigner.Dock = System.Windows.Forms.DockStyle.Fill;
        formDesigner.Parent = this;
        string userCodeFile = "myForm.vb";
        formDesigner.Source = new FormDesignerDataSource(userCodeFile);
    }
}

Here is how to use a Source in the Visual Basic code:

Imports System
Imports Alternet.FormDesigner.WinForms

Partial Public Class Form1
    Inherits Form

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim formDesigner = New FormDesignerControl()
        formDesigner.AutoSaveToSource = False
        formDesigner.Dock = System.Windows.Forms.DockStyle.Fill
        formDesigner.Parent = Me
        Dim userCodeFile As String = "myForm.vb"
        formDesigner.Source = New FormDesignerDataSource(userCodeFile)
    End Sub
End Class

Remarks

You can use one of the existing implementations of IFormDesignerDataSource interface, to load/save the form designer content directly to the file, or translate it to the code editor; or provide own implementation of IFormDesignerDataSource interface.