Results 1 to 5 of 5

Thread: When Displaying how to increse the lenght of Combo Box

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    16

    When Displaying how to increse the lenght of Combo Box

    I have Combo Box. I need to display the the Full value of the string in Combo Box with out increasing the Combo Box Size. Pl Help

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: When Displaying how to increse the lenght of Combo Box

    If you're asking how to increase width of the dropdown portion then try thjis:
    Code:
    Option Explicit
    
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
                    (ByVal hwnd As Long, _
                    ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
    
    Private Const CB_SETDROPPEDWIDTH = &H160
    
    Private Sub Form_Load()
        SendMessage Combo1.hwnd, CB_SETDROPPEDWIDTH, (Combo1.Width / Screen.TwipsPerPixelX) * 2, 0
    End Sub
    Actual width can be calculated using Me.TextWidth("your text goes here") but you will have to:

    - set Fiorm1.Font = Combo1.Font
    - find largest text first - if you loop through items then you can calc each new item and compare its width to previous;

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: When Displaying how to increse the lenght of Combo Box

    That works great for only the dropdown list but it won't increase the width of the text area
    Last edited by jmsrickland; Oct 9th, 2008 at 04:16 PM.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    16

    Re: When Displaying how to increse the lenght of Combo Box

    Thank You So Much..... that what I need.
    Thanks a Lot

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width