473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ComboBox, SendMessage API in .NET

(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.

--------------------------------
From: J A

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>KTqaZonnUUGYs8diNVg8Ww==</Id>
Nov 20 '05 #1
1 3261
* J A via .NET 247 <an*******@dotnet247.com> scripsit:
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.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Richard MSL | last post by:
I am making a combobox, where I add items to the combobox as they are required, as the user scrolls to the top or bottom of the list of items. It is a sorted combobox. Scrolling down works fine,...
7
by: GianPiero Andreis | last post by:
Hello All, let me pose a simple question about combobox and the CB_INSERTSTRING message. Suppose for instance that I already have a combobox handle, how can I declare and use the SendMessage...
9
by: Jason Simard via .NET 247 | last post by:
Hi, Does anyone know a way to make a combobox "read-only", similar to the read-only property of a textbox? In essence, make a combobox readonly...making the combobox text not gray out but be...
0
by: pmcguire | last post by:
I am in the process of designing my own control that inherits from combobox. I have created my own collection class to replace ComboBox.Items and when an item is added to this collection, I use the...
1
by: Frederik Vanderhaegen | last post by:
Hi, I'm trying change the layout of a combobox when f.e. a certain property is set to true. My problem is the following: when I execute the code, the combobox is repainted but there always...
7
by: hung tran | last post by:
Hi, I'd like to drop down a combobox after validating the Leave() event, how can I do that ? Thanks
3
by: =?Utf-8?B?RWRC?= | last post by:
I am trying to duplicate this functionality from VB6: Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long,...
0
by: Randy | last post by:
Hi, I have some comboboxes that are created dynamically at run time based on user actions. I found a procedure on a message board to autofill the combobox text from the dataview that the...
2
by: Andrus | last post by:
SWF DataGridView contains combobox control. Activating combobox and pressing F4 to open dropdown menu causes strange NRE (see below). When I enter some valid value to combobox, press tab,...
1
by: sternr | last post by:
Hey, I have a handle to a combobox in a different process, I want to: 1. Get the item with the X index 2. Be able to set the selected item to Y (index) I know how to do it for Listview...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.