We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I use the configuration file as an embedded resource in my EditControl application ?

 

1. Include the configuration file - DefaultEditorConfig.xml in the project using the VS.NET designer and set its BuildAction property to Embedded Resource in the properties grid.

2. Use the following method to access the config file stream from the resources.

C#

private Stream LoadConfigFromResource(string configFileName)

{

Assembly assembly;

Stream configStream = null;

try

{

assembly = Assembly.GetExecutingAssembly();

configStream = (Stream)assembly.GetManifestResourceStream("SimpleEdit." + configFileName);

}

catch(Exception ex)

{

Console.WriteLine(ex.ToString());

}

return configStream;

}

VB

Private Function LoadConfigFromResource(ByVal configFileName As String) As Stream

Dim assembly As Assembly

Dim configStream As Stream = Nothing

Try

assembly = Assembly.GetExecutingAssembly()

configStream = CType(assembly.GetManifestResourceStream("SimpleEdit." + configFileName), Stream)

Catch ex As Exception

Console.WriteLine(ex.ToString())

End Try

Return configStream

End Function

3.

Apply the config file stream using the following code.

C#

Stream configStream = LoadConfigFromResource("DefaultEditorConfig.xml");

this.editControl1.Configurator.Open(configStream);

this.editControl1.ApplyConfiguration("C");

VB

Dim configStream As Stream = LoadConfigFromResource("DefaultEditorConfig.xml")

Me.editControl1.Configurator.Open(configStream)

Me.editControl1.ApplyConfiguration("C")

Article ID: Published Date: Last Revised Date: Platform: Control:
381 04/30/2011 07/10/2014 WinForms EditControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon