Category / Section
How to list all the lexems having a similar format name in the currently loaded configuration file in WinForms SyntaxEditor (EditControl)?
1 min read
Formatting
You could list all the lexems having a similar format name in the currently loaded configuration file, using the following code snippets. Please refer to the sample attached to know more about it.
C#
private ArrayList GetLexems() { for (int i=1; i "<" =this.editControl1.PhysicalLineCount; i++) { ILexemLine line = this.editControl1.GetLine(i); foreach (ILexem lexem in line.LineLexems) { IConfigLexem configLexem = lexem.Config; if ((configLexem.Format.Name == "MethodName")) { if(!lexemList.Contains(lexem)) { lexemList.Add(lexem); } } } } return lexemList; }
VB
Private Function GetLexems() As ArrayList Dim i As Integer=1 Do While i"<" =Me.editControl1.PhysicalLineCount Dim line As ILexemLine = Me.editControl1.GetLine(i) Dim lexem As ILexem For Each lexem In line.LineLexems Dim configLexem As IConfigLexem = lexem.Config If (configLexem.Format.Name = "MethodName") Then If (Not lexemList.Contains(lexem)) Then lexemList.Add(lexem) End If End If Next lexem i += 1 Loop Return lexemList End Function