Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Feb 20, 2002

Limit Users Typing in Combo Box


The standard textbox has a MaxChars property that lets you limit the number of characters a user can type into it. The drop-down combo does not, but you can emulate this property setting with a simple API call:
 
Private Declare Function SendMessage Lib _
"user32" Alias "SendMessageA" (ByVal hWnd _
As Long, ByVal msg As Long, ByVal wParam _
As Long, ByVal lParam As Long) As Long
Private Const CB_LIMITTEXT = &H141
Private Sub Form_Load()
Const Max_Char = 24
Call SendMessage(Combo1.hWnd, _
CB_LIMITTEXT, Max_Char, 0&)
End Sub

This tip works in 16-bit versions of VB as well, but you
Jim Deutch
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date