|
|
|
Click here to copy the following block | 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 Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" _ (ByVal hwndLock As Long) As Long
Private Const LB_ADDSTRING = &H180 Private Const LB_RESETCONTENT = &H184 Private Const CB_ADDSTRING = &H143 Private Const CB_RESETCONTENT = &H14B
Sub ArrayToListBox(ctrl As Object, arr As Variant, Optional clearIt As Boolean, _ Optional ByVal First As Variant, Optional ByVal Last As Variant) Dim msgReset As Long Dim msgAdd As Long Dim hWnd As Long Dim index As Long If TypeOf ctrl Is ListBox Then msgReset = LB_RESETCONTENT msgAdd = LB_ADDSTRING ElseIf TypeOf ctrl Is ComboBox Then msgReset = CB_RESETCONTENT msgAdd = CB_ADDSTRING Else Exit Sub End If If IsMissing(First) Then First = LBound(arr) If IsMissing(Last) Then Last = UBound(arr) hWnd = ctrl.hWnd LockWindowUpdate hWnd If clearIt Then SendMessage hWnd, msgReset, 0, 0 End If For index = First To Last SendMessage hWnd, msgAdd, 0, ByVal CStr(arr(index)) Next LockWindowUpdate 0 End Sub |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|