Syntax Highlighter does not highlight using user control

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Alvin -
Version: 4.0.0281
I'm using a user control I created as a SQL syntax editor. However, all text is black and white.

XML Header
<SyntaxLanguage Key="SQL" LanguageDefinitionVersion="4.0" Secure="True" WordContainsAdditionalCharacters="@_" SyntaxLanguageTypeName="SqlBrowser.SqlDynamicSyntaxLanguage, SqlBrowser" xmlns="http://ActiproSoftware/SyntaxEditor/4.0/LanguageDefinition">

namespace SqlBrowser
public partial class SQLEditor : UserControl

Source code for _Load method

ctlSQL_Editor.Dock = DockStyle.Fill;
DynamicSyntaxLanguage DOSL = new DynamicSyntaxLanguage("SQL", true);
ctlSQL_Editor.Document.LanguageData = DOSL;
ctlSQL_Editor.Document.LoadLanguageFromXml("ActiproSoftware.SQL.xml", 0);

The code works in the main form. Do I need to have a second XML file for the user control? Is there a limit to the number of Editors per application?

Main form Form_Load method

rtbSqlEditor.Document.LoadLanguageFromXml("ActiproSoftware.SQL.xml", 0);
rtbScript.Document.LoadLanguageFromXml("ActiproSoftware.SQL.xml", 0);
These controls work fine.

[Modified at 04/26/2009 11:48 PM]

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA

I'm not sure what your DynamicSyntaxLanguage creation and setting to LanguageData lines are doing. Those probably can be removed.

The LoadLanguageFromXml line should be all you need if you specified the right path. They way you have it, it will look for that language file in the current application path, and if it is not found there, should look for an Embedded Resource named "ActiproSoftware.SQL.xml" at the root level of your project.

My guess is that it's not finding either of those if you say there is no highlighting working. If you look at it more and can't figure it out, please email us a simple sample showing the problem and we'll tell you what is wrong.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.