Solved

ComboBox pulldown list

Posted on 1998-07-31
5
193 Views
Last Modified: 2010-05-03
I'm finding a way to have a longer pulldown list of the combo box.  
Could anybody tell me how to do this ?
0
Comment
Question by:tam031198
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 30 total points
ID: 1467366
Sure, this is worth more than 30 points, but here you go:

public sub DropDownHeight(m_cbo as combobox, sHeight As Single)
    Dim sItemWidth      As Single
    Dim sItemWHeight    As Single
    Dim sOldLeft        As Single
    Dim sOldTop         As Single
    Dim objParent       As Object
   
    'adjust the height to take into account the client area
    sItemWHeight = ((sHeight + m_cbo.Height) \ screen.twipsperpixely) + 2
    sItemWidth = m_cbo.Width \ screen.twipsperpixelx

    'hold old locations
    sOldLeft = m_cbo.Left
    sOldTop = m_cbo.Top
    Set objParent = m_cbo.Container
   
    'Resize the combo box
    m_sDropHeight = sItemWHeight
    Call MoveWindow(m_cbo.hwnd, 0, 0, CInt(sItemWidth), CInt(sItemWHeight), 1)
   
    'Move the window back into the container
    m_cbo.Left = sOldLeft
    m_cbo.Top = sOldTop
    Set m_cbo.Container = objParent
end sub
0
 

Author Comment

by:tam031198
ID: 1467367
Anthonyc,  I tested your procedure and the program doesn't recognize the "MoveWindow" function.  Is it an API function ? If so, please tell me which Dll I have to use.  
Also, please tell me how may points this procedure worth,  I'll increase points.

Thanks
0
 

Author Comment

by:tam031198
ID: 1467368
Anthonyc,  I tested your procedure and the program doesn't recognize the "MoveWindow" function.  Is it an API function ? If so, please tell me which Dll I have to use.  
Also, please tell me how may points this procedure worth,  I'll increase points.

Thanks
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1467369
use the VB API VIEWER to find the declare for movewindow

Declare Function MoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long

0
 

Author Comment

by:tam031198
ID: 1467370
I have it work now.  Thank you very much Anthonyc !
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

832 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