|
-
Nov 18th, 2015, 02:30 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Combobox CB_ADDSTRING with SendMessage API - appears sorted, even when Sorted=False.
Hello.
Combobox sorted property is set to False, but using API SendMessage method to fill data, items appear sorted.
Code:
Private Const CB_INITSTORAGE = &H161
Public Const CB_ADDSTRING As Long = &H143&
Declare Function SendMessage Lib "user32" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
'Allocate memory for items to add.
Dim lngItems As Long
Dim Retval As Long
lngItems = UBound(sData)
Retval = SendMessage(Combo1.hwnd, CB_INITSTORAGE, lngItems, ByVal (lngItems * 32)) '32 bytes per item
'Add string data
For lngItems = lBound(sData) To UBound(sData)
SendMessage(Combo1.hwnd, CB_ADDSTRING, 0&, ByVal sData(lngItems))
Next lngItems
I presume that the InitStorage resets combobox style to CBS_Sort, but the VB Sorted property is read only, so can't set that at runtime.
Any idea how to prevent combox from sorting data automatically, when using SendMessage API to fill data?
Sorry, wrong alert... It seems that middle layer pulling data from table, sorts data background against sql clause sort order. Damn those junior coders.
Last edited by Tech99; Nov 18th, 2015 at 02:45 AM.
Reason: resolved...
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
|