VBNotebook Home | Functions | Combo Box MaxLength
This routine sets equivalent of MaxLength property for a ComboBox's text area.
First, in General|Declarations, include the following...
__________________________________________________________________________________________
Private Const CB_LIMITTEXT = &H141
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As String) As Long
__________________________________________________________________________________________
And the routine itself....
__________________________________________________________________________________________
Sub SetComboMaxLen(cboCombo As ComboBox, ByVal iLimit As Integer)
Dim nRet As Long
nRet = SendMessageByString(cboCombo.hwnd, CB_LIMITTEXT, iLimit, "")
End Sub
__________________________________________________________________________________________
Copyright 2000-2005, J. Frank Carr