Solved

ComboBox pulldown list

Posted on 1998-07-31
5
192 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

707 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

17 Experts available now in Live!

Get 1:1 Help Now