Solved

ComboBox pulldown list

Posted on 1998-07-31
5
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) 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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

733 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