Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello...
I wanna use intellisense for combobox. I'm done with everything but the issue is when I hit "enter" on the selected item from list the text in the combobox is empty

What I'v done is
*combobox dropdown style to: simple
*combobox Autocompletemode to :suggestappend
*combobox Autocompletesource to:listitems

In the form load event
C#
string[] validDogBreeds = new[] { "Bull Mastiff", "Bulldog", "Bold","Beby","Baby","Ban","Bunch" };
            comboBox1.Items.AddRange(validDogBreeds);


Can u help me?
Posted
Comments
Nithin Sundar 3-Feb-11 5:50am    
Pardon me? I didn't get you. Intellisense helps you code and it isn't part of the application you write(Unless you count the Visual Studio solution itself). It shows suggestions which make typing syntax faster and easier.
krishna kishore58 3-Feb-11 5:54am    
ya i know, but i want the selected item should remain in combobox when i say enter on the selected item like say google search..So is it possible? Hope u got me!
Nithin Sundar 3-Feb-11 6:03am    
That's probably an issue with how the combo box is being handled I guess. What part of your code do you suspect for this bug?

EDIT: The one posted above?
krishna kishore58 3-Feb-11 6:06am    
I dont think that ther's issue with my code. As per me something should be added to resolve this. Can u suggest?
Nithin Sundar 3-Feb-11 6:11am    
Did you try adding each string manually using comboBox1.Items.Add? Does that make a difference?

Also, have you specified the default item which is selected for the combo box?

I think this MIGHT pin down the problem.

You have used it as:


C#
string[] validDogBreeds = new[] { "Bull Mastiff", "Bulldog", "Bold","Beby","Baby","Ban","Bunch" }; 


It should be:

C#
string[] validDogBreeds = new string[] { "Bull Mastiff", "Bulldog", "Bold","Beby","Baby","Ban","Bunch" };



I guess initializing the string with the new operator was the problem. Let me know if it works. :)
 
Share this answer
 
v3
Comments
krishna kishore58 3-Feb-11 6:21am    
sorry no diff, issue is not abt this, when I'm switching from item to item in intellisense, I'm able to put the selected item into combobox but what i want is when i say "enter" the text should remain as usual and the intellisense should vanish...
Nithin Sundar 3-Feb-11 6:27am    
Okay. Let's see, you were coding(not running the program) and selecting the list of items using Intellisense. When you select a syntax suggestion from the list, the intellisense helper doesn't vanish?
krishna kishore58 3-Feb-11 6:37am    
I didnot get u, k let it be.. I'l b trying...Thanx
Change your DropDrownStyle property to dropdown instead of Simple for comboBox and leave other properties as it is and try to run your application. I think this will sort out your problem.

Otherwise do following changes too in your given line of code and run again:

string[] validDogBreeds = { "Bull Mastiff", "Bulldog", "Bold","Beby","Baby","Ban","Bunch" };

My code is executing well with above changes to your lines of code in Visual studio 2005.

Please do reply.
 
Share this answer
 
v2
i was facing the same problem .Finally found the solution.. Just change Dropdown Style to "Dropdown".this would definitely help.

Regards,
Gopal Joshi
Shreesoft Systems
 
Share this answer
 
Comments
Sandeep Mewara 15-Jul-12 2:39am    
Did solution 2 said anything different?

Opening a 1.5 yrs old question and posting already posted answer does not make any sense.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900