ComboBox, SendMessage API in .NET

  • Thread starter J A via .NET 247
  • Start date
J

J A via .NET 247

(Type your message here)

I have to load about 2300 items into a ComboBox in VB.NET. I've found VB6 code that increases the speed for adding, but i can't seem to make it work in .NET.

Does anybody know why the following line of code does not work in .NET?

Private Declare Function SendMessage2 Lib "user32" Alias "SendMessageA" (ByVal hWnd As IntPtr, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Object) As Long

Private Const CB_ADDSTRING = &H143
...
SendMessage cmbTest.Hanndle, CB_ADDSTRING, 0, strItemText

Any assistance would be greatly appreciated. Thanks.
 
H

Herfried K. Wagner [MVP]

* J A via .NET 247 said:
I have to load about 2300 items into a ComboBox in VB.NET. I've found VB6 code that increases the speed for adding, but i can't seem to make it work in .NET.

Does anybody know why the following line of code does not work in .NET?

I doubt that using p/invoke would bring a performance benefit. When
adding more than one item, call 'BeginUpdate' before adding them and
'EndUpdate' after adding the items.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top