I know how to use autocomplete with 2.0 framework on a textbox. I also know
how to use COM interop to use the IAutoComplete interface directly.

But with either approach I seem unable to change the list while the user is
typing.
I have an XML document and i want the user to be able to navigate to nodes
by typing in an XPath.

i.e. when the user types /A
it pops up with
/Animals
/Applications

and when they type
/Animals/
it pops up with:
/Animals/Dog
/Animals/Cat

I do NOT want to prepopulate the whole list.

However when using the .NET framework and changing the list I get an 'Access
Violation' exception which is unacceptable.

I tried to use the AutoComplete COM control (IAutoComplete) based upon this
blog entry :
http://jiangsheng.spaces.live.com/blog/cns!1BE894DEAF296E0A!732.entry

Unfortunately the control doesn't 'ask' for an updated list of items as I
type. I've tried all kinds of nasty tricks, like faking an 'Escape' key press
but none are acceptable because of unwanted sideeffects.

I essentially want the same behavior you get with the windows filename
autocompletion, but I dont see how I can achieve this. I might just have to
make my own autocomplete dropdown,but woudl rather not have to do that.

Any suggestions?

-andy

Re: Autocomplete textbox with dynamic datasource by Sheng

Sheng
Wed Sep 26 11:43:38 PDT 2007

article updated, basically I cleared the text and type it again
programmatically
if(textBoxDemo->SelectionStart>0)
{
autocompleteBindingSource1->Reset();
autocompleteBindingSource1->Bind();
String^ text=textBoxDemo->Text;
int selectionStart=textBoxDemo->SelectionStart;
int selectionLength=textBoxDemo->SelectionLength;
textBoxDemo->SelectionStart=0;
textBoxDemo->SelectionLength=0;
textBoxDemo->SelectAll();
System::Windows::Forms::SendKeys::SendWait("{BACKSPACE}");
textBoxDemo->Text=text;
textBoxDemo->SelectionStart=selectionStart-1;
textBoxDemo->SelectionLength=selectionLength+1;

System::Windows::Forms::SendKeys::SendWait(textBoxDemo->SelectedText);
}
only work in autosuggest mode though.

--
Sheng Jiang
Microsoft MVP in VC++
"andy gilman" <andygilman@discussions.microsoft.com> wrote in message
news:10C0998C-59DC-4ED8-9761-C89795A7D33A@microsoft.com...
> I know how to use autocomplete with 2.0 framework on a textbox. I also
know
> how to use COM interop to use the IAutoComplete interface directly.
>
> But with either approach I seem unable to change the list while the user
is
> typing.
> I have an XML document and i want the user to be able to navigate to nodes
> by typing in an XPath.
>
> i.e. when the user types /A
> it pops up with
> /Animals
> /Applications
>
> and when they type
> /Animals/
> it pops up with:
> /Animals/Dog
> /Animals/Cat
>
> I do NOT want to prepopulate the whole list.
>
> However when using the .NET framework and changing the list I get an
'Access
> Violation' exception which is unacceptable.
>
> I tried to use the AutoComplete COM control (IAutoComplete) based upon
this
> blog entry :
> http://jiangsheng.spaces.live.com/blog/cns!1BE894DEAF296E0A!732.entry
>
> Unfortunately the control doesn't 'ask' for an updated list of items as I
> type. I've tried all kinds of nasty tricks, like faking an 'Escape' key
press
> but none are acceptable because of unwanted sideeffects.
>
> I essentially want the same behavior you get with the windows filename
> autocompletion, but I dont see how I can achieve this. I might just have
to
> make my own autocomplete dropdown,but woudl rather not have to do that.
>
> Any suggestions?
>
> -andy
>
>



Re: Autocomplete textbox with dynamic datasource by Sheng

Sheng
Wed Sep 26 12:22:36 PDT 2007

I think you need to add your implementation to IACList and
ICurrentWorkingDirectory as well.

--
Sheng Jiang
Microsoft MVP in VC++
"andy gilman" <andygilman@discussions.microsoft.com> wrote in message
news:10C0998C-59DC-4ED8-9761-C89795A7D33A@microsoft.com...
> I know how to use autocomplete with 2.0 framework on a textbox. I also
know
> how to use COM interop to use the IAutoComplete interface directly.
>
> But with either approach I seem unable to change the list while the user
is
> typing.
> I have an XML document and i want the user to be able to navigate to nodes
> by typing in an XPath.
>
> i.e. when the user types /A
> it pops up with
> /Animals
> /Applications
>
> and when they type
> /Animals/
> it pops up with:
> /Animals/Dog
> /Animals/Cat
>
> I do NOT want to prepopulate the whole list.
>
> However when using the .NET framework and changing the list I get an
'Access
> Violation' exception which is unacceptable.
>
> I tried to use the AutoComplete COM control (IAutoComplete) based upon
this
> blog entry :
> http://jiangsheng.spaces.live.com/blog/cns!1BE894DEAF296E0A!732.entry
>
> Unfortunately the control doesn't 'ask' for an updated list of items as I
> type. I've tried all kinds of nasty tricks, like faking an 'Escape' key
press
> but none are acceptable because of unwanted sideeffects.
>
> I essentially want the same behavior you get with the windows filename
> autocompletion, but I dont see how I can achieve this. I might just have
to
> make my own autocomplete dropdown,but woudl rather not have to do that.
>
> Any suggestions?
>
> -andy
>
>