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. Image for the cookie policy date
close icon

Building a config programatically (version 3)

Hi, I need to build my language programatically and am having problems associating the Format with my new Lexem. I am adding my format via ConfigLanguage.Add Setting my lexem type to Custom and setting my lexem formatName to the name of my format. At runtime I get the null reference exception in a call to ConfigLexem.get_Format(); I cannot set the format directly as the Format property is read-only. Please can you send me a simple code fragment to demonstrate how to do this as I am unable to find anything in your documentation (the sample app hides the model creation away). Thanks in advance. Leon

1 Reply

LJ Leon Jones March 9, 2005 07:17 AM UTC

This is the code and stack trace: Format myFormat = new Format("MyFormat", Color.Green, Color.Yellow, Color.Aqua, new Font("Tahoma", 8)); language.Add(myFormat); ConfigLexem myLexem = new ConfigLexem("~", "", FormatType.Custom, false); myLexem.FormatName = myFormat.Name; language.Lexems.Add(myLexem); ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at Syncfusion.Windows.Forms.Edit.Implementation.Config.ConfigLexem.get_Format() at Syncfusion.Windows.Forms.Edit.Implementation.Parser.RenderedLine.Measure(Single maxSize) at Syncfusion.Windows.Forms.Edit.Implementation.Parser.RenderableLexemParser.GraphicalToVirtual(Point point) at Syncfusion.Windows.Forms.Edit.StreamEditControl.UpdateToolTip(Object sender, UpdateTooltipEventArgs e) at Syncfusion.Windows.Forms.Edit.Dialogs.ToolTipEx.m_timer_Tick(Object sender, EventArgs e) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)

Loader.
Live Chat Icon For mobile
Up arrow icon