|
-
October 19th, 2001, 12:49 PM
#1
Combo Box Text Max Length
Is there a way to set the max length in a combo box?
Like the TextBox.Max property, if the user types in the text field, it would stop at the max length. There is no such property for combobox, can it be added by a SendMessage API or a wrapper?
Thanks.
-
October 19th, 2001, 03:50 PM
#2
Re: Combo Box Text Max Length
Simply limit text length in the Keypress event like so
option Explicit
private Sub Combo1_KeyPress(KeyAscii as Integer)
If len(Combo1.Text) > 5 then KeyAscii = 0
End Sub
John G
-
November 13th, 2001, 03:23 PM
#3
Re: Combo Box Text Max Length
Does not work correctly. Yes it stops the character from printing but can't use other keys like backspace unless you change focus with the mouse. But thanks for the tip I was able to work around it.
-
November 13th, 2001, 03:51 PM
#4
Re: Combo Box Text Max Length
[vbcode]
private Sub Combo1_KeyPress(KeyAscii as Integer)
If len(Combo1.Text) > 5 and KeyAscii <> 8 then
KeyAscii = 0
End Sub
Will let the Backspace in
Nicolas Bohemier
______________
Un sourire ne coûte rien, mais il rapporte beaucoup; il enrichit celui qui le reçoit sans appauvrir celui qui le donne.
Frank Irving Fletcher
Nicolas Bohemier
-
November 13th, 2001, 03:52 PM
#5
Re: Combo Box Text Max Length
private Sub Combo1_KeyPress(KeyAscii as Integer)
If len(Combo1.Text) > 5 and KeyAscii <> 8 then
KeyAscii = 0
End Sub
Will let the Backspace in
Nicolas Bohemier
______________
Un sourire ne coûte rien, mais il rapporte beaucoup; il enrichit celui qui le reçoit sans appauvrir celui qui le donne.
Frank Irving Fletcher
Nicolas Bohemier
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|