Originally posted by OmOmOm
Combobox Problem
Collapse
X
-
Originally posted by Killer42That's really weird. What happens when you first press "m"? On my system, if I add that list of cities to a combobox with style 2, then press "m" it jumps to the first city starting with "m". As I knew it would. I don't know why your would be acting differently.
Try this exercise. Create a new project with just Form1, and add a combo box to the form, and set its Style property to 2. Then paste this into the code window for the form, replacing anything already there. Give it a run, and tell us what happens when you press "m".Code:Option Explicit DefLng A-Z Private Sub Form_Load() With Combo1 .AddItem "Gujarat" .AddItem "Maharashtra" .AddItem "Mumbai" .AddItem "Raipur" .AddItem "Rajasthan" End With End Sub
Comment
-
-
Originally posted by ShailjaIt is done with Style 2. But is it possible to do the same thing with style 0. Bcoz in style 2, i am not able to set Text property. Can u tell me same thing with style 0
It is done with Style 2. But is it possible to do the same thing with style 0. Bcoz in style 2, i am not able to set Text property. Can u tell me same thing with style 0Comment
-
Thats very simple, try going to the properties of the combobox u r talking about and u have a sorting options, make that to TRUE and give it a try, hope u will get the results u r looking for...
cyaa - subbu
Originally posted by Shailjahi,
I have one combobox. There are 5 items in it.
Gujarat
Maharashtra
Mumbai
Delhi
Deharadun
When i click on combobox and when i press M key from keyboard control should go to items starting from M. How to do code for this?Comment
-
Originally posted by ShailjaIt is done with Style 2. But is it possible to do the same thing with style 0. Bcoz in style 2, i am not able to set Text property. Can u tell me same thing with style 0
If you do want input to be restricted to only what's in the list, then you can use Style 2, and rather than setting .Text, you set .ListIndex to point to the item you want.
If you want to allow entries that are not in the list, then... hm... I do remember seeing some code years ago which was intended to do this "search as you type" behaviour in a combobox. I'd suggest you try some searches on Google or somewhere for various key terms, and try to track it down. I think it just involves one or two API calls.
I might be able to have a bit of a look for it at lunch time, which is in a few hours. But I can't guarantee anything.Comment
Comment