Using Sendmessage with combobox

BaldrickThe4th

Newcomer
Joined
Feb 16, 2004
Messages
22
Hi there

I guess I'm trying to be too clever, but I wonder if someone can shed some light on what is happening.

I'm loading a combobox with a number of thousands of items. To speed the process up I've tried to use:
SendMessage(ComboBox1.Handle, CB_ADDSTRING, -1, "Some Text")

However things don't appear well. The list gets populated, but when clicking on an item in the list I get a subscript error. The dropdown box also only appears to be one line rather than 8.

I can go back to useing the combobox.add method, but I'm curious as to what is going on. Any thoughts anyone.

Thanks.
 
well , the 3rd parameter should be a zero , not -1 so try ...
Visual Basic:
SendMessage(ComboBox1.Handle, CB_ADDSTRING, [COLOR=Red][B]0[/B][/COLOR], "Some Text") '/// note i've replaced the [B]-1[/B] with [B]0[/B]
 
dynamic_sysop said:
well , the 3rd parameter should be a zero , not -1 so try ...
Visual Basic:
SendMessage(ComboBox1.Handle, CB_ADDSTRING, [COLOR=Red][B]0[/B][/COLOR], "Some Text") '/// note i've replaced the [B]-1[/B] with [B]0[/B]

Thanks

I did try that in an earlier attempt but it gave the same results. The error I get is "Specified arguement was out of range of valid values. Parameter name '48' is not a valid value for 'index'.
 
Digging around a little more I found the comment that Sendmessage deals with "objects" whereas the framework expects "strings". I guess this is the problem. I'm back to the slower but more orthodox add function.

Thanks for your help.
 
Back
Top