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.
Unfortunately, activation email could not send to your email. Please try again.

How do I create a DOM reader like application using EditControl ?

 

The DOM reader can be created using the ILexemLine and IConfigLexem interface as shown in the code below.

C#

private ArrayList GetLexems()

{

int j=0;

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") || (configLexem.Format.Name == "PropertyName") || (configLexem.Format.Name == "EventHandler"))

{

a[j++]=i;

lexemList.Add(lexem);

}

}

}

return lexemList;

}

private ArrayList GetLexems2()

{int j=0;

for (int i=1; i=this.editControl1.PhysicalLineCount; i++)

{

ILexemLine line = this.editControl1.GetLine(i);

foreach (ILexem lexem2 in line.LineLexems)

{

IConfigLexem configLexem = lexem2.Config;

if((configLexem.Format.Name == "NameSpaceName"))

{

strNameSpace = lexem2.Text;

}

if ((configLexem.Format.Name == "class"))

{

strClass = lexem2.Text;

a[j++]=i;

lexemList2.Add(lexem2);

}

}

}

return lexemList2;

}

VB

Private Function GetLexems() As ArrayList

Dim j As Integer=0

Dim i As Integer=1

Do While i=Me.editControl1.PhysicalLineCount

Dim line As ILexemLine = Me.editControl1.GetLine(i)

For Each lexem As ILexem In line.LineLexems

Dim configLexem As IConfigLexem = lexem.Config

If (configLexem.Format.Name = "MethodName") OrElse (configLexem.Format.Name = "PropertyName") OrElse (configLexem.Format.Name = "EventHandler") Then

a(j += 1)=i

lexemList.Add(lexem)

End If

Next lexem

i += 1

Loop

Return lexemList

End Function

Private Function GetLexems2() As ArrayList

Dim j As Integer=0

Dim i As Integer=1

Do While i=Me.editControl1.PhysicalLineCount

Dim line As ILexemLine = Me.editControl1.GetLine(i)

For Each lexem2 As ILexem In line.LineLexems

Dim configLexem As IConfigLexem = lexem2.Config

If (configLexem.Format.Name = "NameSpaceName") Then

strNameSpace = lexem2.Text

End If

If (configLexem.Format.Name = "class") Then

strClass = lexem2.Text

a(j += 1)=i

lexemList2.Add(lexem2)

End If

Next lexem2

i += 1

Loop

Return lexemList2

End Function

Please refer to the test sample attached below for additional information in this regard.

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

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.