Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 132,127 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 2,010 people online right now. Registration is fast and FREE... Join Now!




AutoComplete TextBox

 
Reply to this topicStart new topic

AutoComplete TextBox, Dropdown suggested text click event?

Jordan CB
post 21 May, 2008 - 05:54 AM
Post #1


New D.I.C Head

*
Joined: 16 Apr, 2008
Posts: 15

Hello,

I have a textbox that is linked to a custom source. The textbox autocomplete features is working just fine. I just have a question on some events that I can use to know when the user has selected the suggested text from the autocomplete dropdown box. I am able to check for user hitting Tab or Enter just fine, now I need to be able to know when the user is clicking on a specific item in the suggestions dropdown box. Where is this event stored? Or how can I monitor this click.

Anyone ran into this before? Any help is appreciated. Thanks!

-- Jordan
User is offlineProfile CardPM

Go to the top of the page

zakary
post 21 May, 2008 - 06:25 AM
Post #2


D.I.C Regular

Group Icon
Joined: 15 Feb, 2005
Posts: 401



Thanked 6 times

Dream Kudos: 175
My Contributions


double click on your dropdown box this will create a comboBox1_SelectedIndexChanged method so when ever the user select the dropdown box and selects an item you can store that value

csharp

string dropdownboxtext= string.Empty;
private void comboBox1_SelectedIndexChanged (object sender, EventArgs e)
{
dropdownboxtext= comboBox1.SelectedItem.ToString();
}


dropdownboxtextwill contain the value of the selected item in the drop down
User is offlineProfile CardPM

Go to the top of the page

Jordan CB
post 21 May, 2008 - 06:37 AM
Post #3


New D.I.C Head

*
Joined: 16 Apr, 2008
Posts: 15

QUOTE(zakary @ 21 May, 2008 - 07:25 AM) *

double click on your dropdown box this will create a comboBox1_SelectedIndexChanged method so when ever the user select the dropdown box and selects an item you can store that value

csharp

string dropdownboxtext= string.Empty;
private void comboBox1_SelectedIndexChanged (object sender, EventArgs e)
{
dropdownboxtext= comboBox1.SelectedItem.ToString();
}


dropdownboxtextwill contain the value of the selected item in the drop down



I'm not following for some reason, I don't have a combo box control that I am using, I am using a TextBox control for my autocomplete.
I have created a custom auto complete source through a database loop. AutoSoureMode is set to SuggestAppend. Doesn't this mode of Suggest tell the textbox somehow to add that dropdown box with the suggested items. It is that magical dropdown box there that I am trying to access the events of. Does that make any sense? Sorry if I'm being vague here.

I appreciate the help.

-- Jordan
User is offlineProfile CardPM

Go to the top of the page

zakary
post 21 May, 2008 - 06:52 AM
Post #4


D.I.C Regular

Group Icon
Joined: 15 Feb, 2005
Posts: 401



Thanked 6 times

Dream Kudos: 175
My Contributions


Oh I am sorry. Get us a little time to look into that.
User is offlineProfile CardPM

Go to the top of the page

Jordan CB
post 21 May, 2008 - 07:18 AM
Post #5


New D.I.C Head

*
Joined: 16 Apr, 2008
Posts: 15

zakary,

No Problem. My fault in my original explanation.

I figured this is hiding somewhere, but I have no clue where to look for that. My end result was just when the user does one of the following to add the suggested text by the autocomplete to a listbox. So Tab & Enter, and then when the user Clicks on the suggested text, I.E. if the item they need is two or three suggestions down in the dropdown list.

Thanks for your help!

-- Jordan
User is offlineProfile CardPM

Go to the top of the page

sir.rothschild
post 30 Sep, 2008 - 12:34 AM
Post #6


New D.I.C Head

*
Joined: 29 Sep, 2008
Posts: 2

QUOTE(Jordan CB @ 21 May, 2008 - 08:18 AM) *

zakary,

No Problem. My fault in my original explanation.

I figured this is hiding somewhere, but I have no clue where to look for that. My end result was just when the user does one of the following to add the suggested text by the autocomplete to a listbox. So Tab & Enter, and then when the user Clicks on the suggested text, I.E. if the item they need is two or three suggestions down in the dropdown list.

Thanks for your help!

-- Jordan

User is offlineProfile CardPM

Go to the top of the page

sir.rothschild
post 30 Sep, 2008 - 12:43 AM
Post #7


New D.I.C Head

*
Joined: 29 Sep, 2008
Posts: 2

Hi had the same problem... here is how i got it working. Add a key down event to your textbox. in the keydown check if the enter key was pressed - clicking on a suggested text line is same as pressing enter -- in the if statement you can then get the text with textbox.text. cheers ewald
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 30 Sep, 2008 - 05:27 AM
Post #8


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,919



Thanked 117 times

Dream Kudos: 8475

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


Here is a tutorial on creating an Auto-Complete TextBox Control that you may find useful smile.gif
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 11:33AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month