Combobox Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #16
    Originally posted by OmOmOm
    Hi
    I m creating a Visual C# application.
    I don't think the VB forum is really the appropriate place for your post, then. You probably should ask your question somewhere like the C++ or Miscellaneous forum.

    Comment

    • Shailja
      New Member
      • Feb 2007
      • 123

      #17
      Originally posted by Killer42
      That'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
      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 0

      Comment

      • inderjeetkalra
        New Member
        • Mar 2007
        • 3

        #18
        just check there whether the press character frm keyboard is M or not
        that's it ??

        Comment

        • Shailja
          New Member
          • Feb 2007
          • 123

          #19
          Originally posted by Shailja
          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 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 0

          Comment

          • subrahmanyaam
            New Member
            • Nov 2006
            • 24

            #20
            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 Shailja
            hi,

            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

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #21
              Originally posted by Shailja
              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 0
              Are you sure you need to set the Text property? Does that mean you don't want input to be limited to what is in the list?

              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

              Working...