Text Auto-completion

  • Thread starter Thread starter Roshan
  • Start date Start date
R

Roshan

Hi All,

I am developing an xml editor, inwhich I want to include text
auto-completion.
When I finish entering start element (ie.<Hello>) on rich text box,
the end element (ie.</Hello>) should be entered automatically and also
the cursor is automatically positioned in between the start element
and end element(ie.<Hello>|</Hello>). How should I do this using C#
for Windows environment?

Thanx in advance.

Regards,
Riath
 
Riath,

Off the top of my head, you'll need to monitoring changes to the edit box,
checking for ">".
At that point, you should back trace to see if there is a "<" close by (make
sure you know and apply the rules for XML node naming).
If one is found, get the cursor location, and then copy all the text between
the tags, pad with your "</" and ">" and insert the text.
You can then use the cursor location you stored to apply to the text box.

All these operations should be possible with TextBox properties and methods.

Good luck!

Dan.
 
Back
Top