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.
Syncfusion Feedback

How do I implement VS.NET like XML tag insertion feature using EditControl?

 

This can be used, while editing the XML language tags in the Essential Edit.

The cursor can be placed at any positon of the line and the nodes will be inserted correctly in the beginning and the end of the current line.

This feature saves time while editing your XML documents using the Essential Edit.

Refer to the code attached to know more about it.

C#

private void menuItem_Click(object sender, System.EventArgs e)

{

this.inputDialog.ShowDialog();

if (this.accepted == true)

{

if(this.inputString.Equals(""))

{

MessageBox.Show("The node name cannot be empty");

}

else

{

this.editControl1.MoveToLineStart();

this.editControl1.InsertText(this.editControl1.CurrentLine,(this.editControl1.CurrentColumn)," ");

this.editControl1.InsertTexthis.editControl1.CurrentLine,this.editControl1.CurrentColumn ,"<"+this.inputString+">");

this.editControl1.InsertText(this.editControl1.CurrentLine,(this.editControl1.CurrentColumn)," ");

this.editControl1.AppendText("</"+this.inputString+">");

}

}

}

VB

Private Sub menuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menuItem12.Click

Me.inputDialog.ShowDialog()

If Me.accepted = True Then

If Me.inputString.Equals("") Then

MessageBox.Show("The node name cannot be empty")

Else

Me.editControl1.MoveToLineStart()

Me.editControl1.InsertText(Me.editControl1.CurrentLine,(Me.editControl1.CurrentColumn)," ")

Me.editControl1.InsertText (Me.editControl1.CurrentLine,Me.editControl1.CurrentColumn,"<"+Me.inputString+">")

Me.editControl1.InsertText(Me.editControl1.CurrentLine,(Me.editControl1.CurrentColumn)," ")

Me.editControl1.AppendText("</"+Me.inputString+">")

End If

End If

End Sub

Article ID: Published Date: Last Revised Date: Platform: Control:
309 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

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