Start New Discussion within our Software Development Community

I am using a few combo boxes in my form and have set the DropDownStyle property set to DropDownList. I want to expand i.e. show ALL options when the control gets focus (similar to presing the F4). Also some entries of my list have a greater width then the width at design time. I want to display the entire entries based on the width when the control gets focus. I also want to implement autocomplete feature in my combo boxes so that the user can continue typing and only matching entries gets displayed. But when I type the second alphabet the entry which begins with that alphabet is getting selected. I have done all this and more in VisualBasic 6 using API calls, but when it comes to C# 2005, I am clueless. I request members in helping me with this.

Most of the Comboboxes of my form have fixed entries, but in some others I want to display unique values from a table. How do I go about this?

Thank you.

Lalit Kumar Barik
India

There's a few questions in there.

"I want to expand i.e. show ALL options when the control gets focus" - You could put something in the paint event looping through the values and use measureString to get the width. This could get processing expensive. If the values are static after the form loads, it would be better to just do an initialization and set the sizes once.

'I want to display the entire entries based on the width when the control gets focus' - I don't understand this need. Coupled with the first questions, the comboBox control does this natively.

Your last question about filtering, I think the way to do it is to use a datatable and bind the table to the comboBox. Then use the table to do the filtering.

This article has been dead for over six months. Start a new discussion instead.