VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Make a dropdown bigger than its combobox Simple

by Rokinroj (3 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (9 Votes)

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

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

Rate Make a dropdown bigger than its combobox Simple

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

Download this snippet    Add to My Saved Code

Make a dropdown bigger than its combobox Simple Comments

No comments have been posted about Make a dropdown bigger than its combobox Simple. Why not be the first to post a comment about Make a dropdown bigger than its combobox Simple.

Post your comment

Subject:
Message:
0/1000 characters