Custom control Dropdown

Posted on 2011-10-13
Last Modified: 2012-05-12
I've developed a custom control dropdown.
When entering data it must bring up a list of all the suggested options.

It seems easy, but if I add a listbox to my control that I hide and show when the user enter text it is working except when the combobox is at the bottom of a dialog form.

I have then tried to make the dropdown list part an additional form that would show when data is entered, but because my dialog form is shown modal, I also need to show this dropdown list form modal, and then I cannot enter text in the textbox anymore.

Don't know if this make sense?

Question by:koossa
    LVL 16

    Assisted Solution

    The  "Windows" solution to displaying a drop down list when the main combobox is too close to the bottom of the window is to have the drop down list appear ABOVE the combobox.

    Author Comment

    To give you and idea of what my problem is:

    This is a std Microsoft dropdown
    STD Combo

    This is my custom control dropdown
    Custom Combo

    LVL 16

    Accepted Solution

    Based on the zone you've placed this question, I'm assuming you're programming in VB6.  But your sample does NOT look like a VB6 application.  What exactly are you using to build this custom control as well as what are you using to build the application?

    The thing that is making the Microsoft drop down behave as it does is because I believe the drop-down list is created with a window that has a style of "popup".  If you were programming in C++, you could build a popup style window yourself on the fly to accomplish what you want to do.

    But if you are using a simple list control to simulate your drop down, the list control isn't a popup style window.  As such, the parent window clips the child window where it exceeds the limits of the parent window.

    By contrast, a real Combo box has a drop down list that IS a popup window and behaves like you want.

    As an example, I create a VB User Control that consisted of a Combo box and a List box that were populated by 5 lines of text on startup.  The controls were placed on a form such that the list box and drop down list would exceed the limits of the form.  As you can see, the Windows Combo within my User Control behaves just like you want, while the list box works just like you don't want.

    And if you are programming in VB, I can't find any options that allow you to declare a window or child window or child control to be of style popup.  If you were programming in C++, or wanted to spend the time to dig into the windows API, you could build the window on the fly with a style of popup, but I can't find a way to do it in VB other than using existing controls that include popup windows.

    Author Comment


    Yes, everything is developed in VB6

    Author Closing Comment

    Thank you

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now