Text Auto-completion

G

Guest

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.
 
B

Bob Powell [MVP]

Having done this in the past I'll tell you how...

You need a decent BTree collection implementation which can be a bought in
third-party or home-grown one. To be honest writing one yourself is a pain,
I bought BTree Gold.

Then, as you type, trap the textbox change event and feed the first n
characters into the btree. It will give you back an array of all words that
begin with that character sequence.

I did a medical dictionary lookup for a company that needed to search
100,000+ words and phrases. the search was as fast as I could type so it was
a great result.

HTH

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

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