Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have to take one propertygrid.In that have to take combobox as Name.by using arraylist i have to fill all name od list in combobox.
Now i want to display names of list by typing letter.Means suppose in list have some nmaes.If i have to type letter "A",then in list want to show all names which start bye letter "A".
How to do it?



Can we put seperate combobox control on created by combobox through propertygrid?

By using it;

[CategoryAttribute("Button")]<br />
 [MergableProperty(false)]<br />
  [TypeConverter( typeof( ListNameConverter ) )]<br />

have to create combobox n call arrylisy.through list fill name.But,not able to call key_Down Event in it.So not able to get list of names by names.how to cal event in property class??

Or can we put new combobox control in it?But in this occuered some problem related to dimensions n all.

Waht is the the solution?
Posted
Updated 15-May-12 3:48am
v3
Comments
Member 8131879[Sneha K] 15-May-12 9:05am    
Can we put seperate combobox control on created by combobox through propertygrid?

By using it;

[CategoryAttribute("Button")]
[MergableProperty(false)]
[TypeConverter( typeof( ListNameConverter ) )]

have to create combobox n call arrylisy.through list fill name.But,not able to call key_Down Event in it.So not able to get list of names by names.how to cal event in property class??

Or can we put new combobox control in it?But in this occuered some problem related to dimensions n all.

Waht is the the solution?
Maciej Los 15-May-12 9:48am    
Use "Improve question" to update your question.

Hello

Simple way is:
1. Bind a List to ComboBox
2. In TextChanged event of ComboBox:
C#
private void MyComboBox_TextChanged(object sender, EventArgs e)
{
    List<string> myList = //Get it from a dataset or ...

    string text = ((ComboBox)sender).Text.ToLower();

    var names = myList.Where(n => n.ToLower().StartsWith(text));

    if (names.Count() > 0)
    {
        myList = names.ToList();

        //rebind MyList to combo ...
    }
}
 
Share this answer
 
v5
Comments
Member 8131879[Sneha K] 16-May-12 0:22am    
Hello,
As per given solution by you this is the next procedure after getting KeyPress and KeyDown event.But,in propertygrid class not able to call or acess these events.So how to acess it?
Shahin Khorshidnia 16-May-12 5:28am    
Hi, When you are typing in ComboBox then it's events can be fire without problem. Do you want to type outside of the Combo?
Member 8131879[Sneha K] 17-May-12 0:25am    
Hello, In my combobox have some list of names.When i select particular name then the list of names keep remain open as it is. Suppose i type letter "A" then display list of all names which starts by letter "A".Currently i jus display name which type by name but not able to show whole list .How to do it? Example:In google search engine when we type any letter then display lisy of all items which starts by typing letter.Like that i want it.
Shahin Khorshidnia 17-May-12 10:06am    
As I said, You need a combobox and write the code in its TextChanged event. I explained it enough in my solution .
SQL
select combo box property then
 1. autocompletemode option select suggestappend option.
 2. AutoCompleteSource option select Lisititem option
 
Share this answer
 
v2

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