473,322 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

TextBox AutoComplete not quite good enough

I want to have AutoSuggest based on a database (or webservice) query. So as
the user types say... a last name I will make an async call to a service to
get matches, then set the suggestion list at runtime.

I tried this quick by handling the key down event and building a "dumb"
Suggestion list and assigning to the TextBox control but it seem to lock the
control up from any additional text input and the autocomplete list is not
displayed.

Has anyone mananaged to put this feature of the TextBox to use beyond the
built is sources?
Jan 13 '08 #1
8 7681
OK, I got this figured out. It's pretty cool actually and works better than
I thought. It's screaming to be extended to clean up the behavior, I will
post the extended control later when I'm done.

-Steve

"Steve K." <no***@nowhere.comwrote in message
news:uU**************@TK2MSFTNGP06.phx.gbl...
>I want to have AutoSuggest based on a database (or webservice) query. So
as the user types say... a last name I will make an async call to a service
to get matches, then set the suggestion list at runtime.

I tried this quick by handling the key down event and building a "dumb"
Suggestion list and assigning to the TextBox control but it seem to lock
the control up from any additional text input and the autocomplete list is
not displayed.

Has anyone mananaged to put this feature of the TextBox to use beyond the
built is sources?

Jan 13 '08 #2
Well, this is a bit anticlimactic.
There are a TON of bugs when you specify OwnerDraw for a TextBox... it's
useless.

So... if and when I find a workaround I will post the code.
-Steve

"Steve K." <no***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
OK, I got this figured out. It's pretty cool actually and works better
than I thought. It's screaming to be extended to clean up the behavior, I
will post the extended control later when I'm done.

-Steve

"Steve K." <no***@nowhere.comwrote in message
news:uU**************@TK2MSFTNGP06.phx.gbl...
>>I want to have AutoSuggest based on a database (or webservice) query. So
as the user types say... a last name I will make an async call to a
service to get matches, then set the suggestion list at runtime.

I tried this quick by handling the key down event and building a "dumb"
Suggestion list and assigning to the TextBox control but it seem to lock
the control up from any additional text input and the autocomplete list
is not displayed.

Has anyone mananaged to put this feature of the TextBox to use beyond the
built is sources?


Jan 14 '08 #3
Hi,

Are you using asp.net ?
In a win app you would have to use another cntrol to hold the list of items.
I know that the framework does not provide anything like thta, you should
first try to google for a similar control or check a third party control set
(like infragistics) to see if they provide it.

"Steve K." <no***@nowhere.comwrote in message
news:uU**************@TK2MSFTNGP06.phx.gbl...
>I want to have AutoSuggest based on a database (or webservice) query. So
as the user types say... a last name I will make an async call to a service
to get matches, then set the suggestion list at runtime.

I tried this quick by handling the key down event and building a "dumb"
Suggestion list and assigning to the TextBox control but it seem to lock
the control up from any additional text input and the autocomplete list is
not displayed.

Has anyone mananaged to put this feature of the TextBox to use beyond the
built is sources?
Jan 14 '08 #4
Hi,

Thanks for the reply.
I've got it working pretty well. I'm only displaying strings for the
suggestions, but their values are pulled from a database.

I've derived my own TextBox class that adds some events and properties to
make it a little easier (IMHO).
For example:

// This is an event handler in the host form:
private void pmdTextBox1_AutoCompleteListNeeded(object sender,
AutoCompleteListNeededEventArgs args)
{
string[] dummy = new string[] { "Apple", "Appalachian", "Appp",
"Appppppp" };
args.SourceList = dummy;
}

I will post the code later. It's become quite large as it's next to
impossible to do User Painting with a TextBox although there are ways... it
has made the code grow.

More info later,
Steve
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:Od**************@TK2MSFTNGP05.phx.gbl...
Hi,

Are you using asp.net ?
In a win app you would have to use another cntrol to hold the list of
items. I know that the framework does not provide anything like thta, you
should first try to google for a similar control or check a third party
control set (like infragistics) to see if they provide it.

"Steve K." <no***@nowhere.comwrote in message
news:uU**************@TK2MSFTNGP06.phx.gbl...
>>I want to have AutoSuggest based on a database (or webservice) query. So
as the user types say... a last name I will make an async call to a
service to get matches, then set the suggestion list at runtime.

I tried this quick by handling the key down event and building a "dumb"
Suggestion list and assigning to the TextBox control but it seem to lock
the control up from any additional text input and the autocomplete list
is not displayed.

Has anyone mananaged to put this feature of the TextBox to use beyond the
built is sources?

Jan 14 '08 #5
If anyone is interested I have posted the code here:
http://pmddirect.com/sklett/PMDTextBoxReview.html

This is the first project I've done like this so if you find it at all
interesting or just like to comment I would REALLY like to know what I'm
doing right and what I'm doing wrong and any possible suggestions you might
have.

-Steve

"Steve K." <no***@nowhere.comwrote in message
news:ek**************@TK2MSFTNGP05.phx.gbl...
Hi,

Thanks for the reply.
I've got it working pretty well. I'm only displaying strings for the
suggestions, but their values are pulled from a database.

I've derived my own TextBox class that adds some events and properties to
make it a little easier (IMHO).
For example:

// This is an event handler in the host form:
private void pmdTextBox1_AutoCompleteListNeeded(object sender,
AutoCompleteListNeededEventArgs args)
{
string[] dummy = new string[] { "Apple", "Appalachian", "Appp",
"Appppppp" };
args.SourceList = dummy;
}

I will post the code later. It's become quite large as it's next to
impossible to do User Painting with a TextBox although there are ways...
it has made the code grow.

More info later,
Steve
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:Od**************@TK2MSFTNGP05.phx.gbl...
>Hi,

Are you using asp.net ?
In a win app you would have to use another cntrol to hold the list of
items. I know that the framework does not provide anything like thta, you
should first try to google for a similar control or check a third party
control set (like infragistics) to see if they provide it.

"Steve K." <no***@nowhere.comwrote in message
news:uU**************@TK2MSFTNGP06.phx.gbl...
>>>I want to have AutoSuggest based on a database (or webservice) query. So
as the user types say... a last name I will make an async call to a
service to get matches, then set the suggestion list at runtime.

I tried this quick by handling the key down event and building a "dumb"
Suggestion list and assigning to the TextBox control but it seem to lock
the control up from any additional text input and the autocomplete list
is not displayed.

Has anyone mananaged to put this feature of the TextBox to use beyond
the built is sources?


Jan 14 '08 #6
This is the first project I've done like this so if you find it at all
interesting or just like to comment I would REALLY like to know what I'm
doing right and what I'm doing wrong and any possible suggestions you
might have.
Can you use ComBox for this ?
Can you make it running in MONO (remove direct winapi calls ) ?

Combobox native dropdown button can be used to open search window like in
IE.
Also, .NET 2 Combobox custom AutoCompleteSource can be used to remove custom
paining.

Andrus.
Jan 14 '08 #7

"Andrus" <ko********@hot.eewrote in message
news:OV**************@TK2MSFTNGP04.phx.gbl...
>This is the first project I've done like this so if you find it at all
interesting or just like to comment I would REALLY like to know what I'm
doing right and what I'm doing wrong and any possible suggestions you
might have.

Can you use ComBox for this ?
In the case there is no match I still want the user to type in the intended
value. I'm not sure how the combobox would work in this regard.
Can you make it running in MONO (remove direct winapi calls ) ?
No, maybe someone could, but I can't. I've never even seen linux ;0)
>
Combobox native dropdown button can be used to open search window like in
IE.
Also, .NET 2 Combobox custom AutoCompleteSource can be used to remove
custom paining.
I'm not painting the list of items, I'm letting the TextBox do that. I'm
paiting the small icon and the "Add New" link.
>
Andrus.

Jan 14 '08 #8
>Can you use ComBox for this ?
>
In the case there is no match I still want the user to type in the
intended value. I'm not sure how the combobox would work in this regard.
comboBox contians textbox so all textbox goodis must apply.
Combobox Dropdown style allows to enter free text into int.
>Can you make it running in MONO (remove direct winapi calls ) ?
No, maybe someone could, but I can't. I've never even seen linux ;0)
You can download and run MONO in Windows.
>Combobox native dropdown button can be used to open search window like in
IE.
Also, .NET 2 Combobox custom AutoCompleteSource can be used to remove
custom paining.

I'm not painting the list of items, I'm letting the TextBox do that. I'm
paiting the small icon and the "Add New" link.
Can you remove direct windows api calls by using combobox dropdown button ?

Andrus.
Jan 14 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

40
by: Alex | last post by:
Hello, does anybody know how to turn off the autocomplete feature for a certain text field? I am aware of the "autocomplete" attribute, but I have seen other implementions achieving it...
4
by: Craig G | last post by:
i have the following code for validating a textbox once a page posts, but the problem i am having is that the TextChanged event won't fire next time if the user does not change the value again ...
8
by: John | last post by:
Hi, I am developing an application using VB.Net and hope that the textbox can process features which are similar to auto-complete features in Window. For example, when user types "ap" in a...
0
by: venu | last post by:
Hi All I need some help from u guys. iam working on aspx page.in this page i have lot fields. text boxes and dropdown lists .. First filed should be a autocomplete filed. this text has onblur...
1
by: rbg.net | last post by:
I know that there is a autocomplete property for the HTML "INPUT type=text" control which if set to OFF, disables autocomplete of the input textbox (doesn't remember previously entered values) ...
8
by: nil | last post by:
Hello all, It's urgent... i want to add autocomplete textbox facility in my application like google. as you type it suggests option to the user..i want the same kind of facility...i know i...
2
by: HariKutty | last post by:
Hello Every one My Use Case: I want to display the list of matching email address from the word typed in by the User. Example If the User types "a" in textbox then it shoud display ...
1
by: =?Utf-8?B?UmV5?= | last post by:
I have a textbox and linked that with the autocomplete extender I have created the webservice and the WebMethod and returns a ToArray to the textbox. Everything works when I type normal string...
3
by: TS | last post by:
I am using IE 7. I have a website running on my local machine (localhost) and auto complete doesnt work for any of the textboxes, but going to web sites on the internet does support this so i know...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.