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

Change language syntax highliting on the fly for same file?

Thread ID:





96406 Sep 10,2010 05:04 PM UTC Sep 15,2010 05:54 AM UTC WinForms 3
Tags: EditControl
Administrator [Syncfusion]
Asked On September 10, 2010 05:04 PM UTC

Hello, I have the following problem with the Editor control(latest release).

When I initialize control, I apply some language to it. For example, VB.


after that, I set Text property with some code.

After that, selecting some radio button, I'd like to have the same text highlighting as C#:


But C# highlighting is not applied, because the default name of my file (which does not exist really, only in the editor) is Untitled.vb.
(If I starts with CSharp configuration, I accordingly have Untitled.cs and can't apply VB.Net syntax).

What is the simplest method to change syntax highlighting without loading another file with another extension.


Lingaraj S [Syncfusion]
Replied On September 14, 2010 12:05 PM UTC


Thank you for your interest in Syncfusion products.

We are unable reproduce the mentioned issue in EditControl when change the Configuration language for Editor. We have tested the issue with simple sample and attached in following link.

Please have look at the above sample and let me know if you still face the issue. Could you please try to reproduce the issue in above sample that could be helpful for us to provide a better solution?

Lingaraj S.

Administrator [Syncfusion]
Replied On September 14, 2010 02:49 PM UTC

yes, you're right, my example was not correct enough.
I'm attaching my sample now.

The steps are:
1. I add Editor, in Form_Load I set this.editControl1.ApplyConfiguration(KnownLanguages.VBNET);

2. I have button named C#, in OnClick method I write the following:

string custCode = "//**************************************************\r\n";
custCode += "// Custom C# code for " + "\r\n";
custCode += "// Created: " + System.DateTime.Now.ToString() + "\r\n";
custCode += "//**************************************************\r\n";

//this line is for show that in fact syntax is VB
custCode += "'this line is for show that the syntax is not shown correctly \r\n";
custCode += "Imports System\r\n";
custCode += "using System;\r\n";

this.editControl1.Text = custCode;
this.editControl1.ApplyConfiguration(KnownLanguages.CSharp); // won't be c#

So, I add some text and set configuration to the c#.
When I press this button, syntax highlighting won't change to C#.

I can set configuration before setting the text, in this case, C# will be shown correctly.

But in this case, if I click another button - VB.NET, where configuration is changed to the VB.NET, syntax will remain C#.


Lingaraj S [Syncfusion]
Replied On September 15, 2010 05:54 AM UTC


Thanks for the update.

We usually share general informations alone on Community Forums, for issue related queries you can use our Direct Trac support at the following link,


Please let us know if you have concerns on this,

Lingaraj S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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