Text Auto-completion

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
 
D

Dan Bass

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top