Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum text length in Combo box with style vbdropdowncombo 1

Status
Not open for further replies.

Ramya1

Programmer
Oct 11, 2002
40
US
Hi,
I'm using a combobox with style vbdropdowncombo. When i tried to enter text, it accepts only 253 characters. I would like to enter upto 1350 characters. I'm wondering if there is any vb limitation on maximum number of characters that can be entered for combobox with style vbdropdowncombo. If there is any alternative to accomplish this, kindly let me know.

Thanks for your help in advance.
Ramya.
 
Won't that look awful if you load such long strings into your combo box? How were you planning on using the combo box?

Transcend
[gorgeous]
 
I'm loading a listbox with the text from combobox. I want to give the end users ability to use long strings. That's all.

Thanks,
Ramiya.
 
Could you explain more what it is you are doing?

How are you loading data into the combo box?
Are the users entering it? Could you use a text box instead?

Transcend
[gorgeous]
 
Yes, I'm loading data into the combo box. The users can also enter text in the combo box since the style is vbdropdowncombo. When loading data from the dropdown, it accepts any string length. But while entering text in the combo box it limits the text length to 253.

Thanks,
Ramiya.
 
I'm with Transcend, not sure why you would use a combo in this way but here is how to do it:

Private Const CB_LIMITTEXT = &H141
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Form_Load()
Dim lngLimit as long
lngLimit = 0
SendMessage Combo1.hwnd, CB_LIMITTEXT, lngLimit, ByVal 0&
End Sub

The lngLimit parameter allows you to limit the length which is nice can be very useful but when set to 0 limits the text length to 0x7FFFFFFE characters.

Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Hi DrJavaJoe,
Thanks so much. It worked. I would've never figured out. I didn't know that sendmessage function can be used for stuff other than sending messages between applications or controls.

When i started testing the code, the development environment just shut down. But i couldn't reproduce. Any idea of why this might happen.

Apprecite your help.

Thanks,
Ramya.
 
No clue, probably just one of those flukes. It shouldn't have anything to do with this message.

Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top