Search Tools Links Login

Make a dropdown bigger than its combobox **Simple**


The only code I could find for this used tons of api and was a bit difficult (at least for me) this code is only 3 lines and works well.It
lets you save room on your form by making your dropdown bigger than its combobox. My use for this was as a state field on a form. The box showed the two letter abbreviation for each state, but if you dropped down the box it showed the full state name. I'm sure you will find your own uses for this

Original Author: Rokinroj

API Declarations

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

Code

Private Sub Form_Load()
  SendMessage cboState.hwnd, CB_SETDROPPEDWIDTH, 135, 0
'be sure to either carry the line down with a _, or put it all on one line. The complete line should start with SendMessage and end with 0
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 96 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.