VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a La

by Patrick Lockefeer (VII) (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 8th December 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a Label

API Declarations



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 Const CB_ADDSTRING = &H143

'declaration variables :

Dim strItemText As String
Dim i As Integer
Dim dblTimer As Double

'Controls Used :
'ComboBox Name : Combo1
'Commandbutton Name : Command1
'Label Name : Label1 (to show the time)

Rate Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a La



'European date : 12-08-2005
'Please see my other snippets on page 607,609,610 and this page (611)
'Note you can change Combo1 in List1 and adding a Listbox to your form
 (if you like)

Private Sub Command1_Click()
    
    Combo1.Clear 'Clear method ComboBox
    
    dblTimer = Timer 'Assign variable to Timer
    
    'Adding items to Combobox with Win32 API
    For i = 1 To 1000 'Change 1000 to a higher number (if you like)
        strItemText = CStr(i)
        SendMessage Combo1.hWnd, CB_ADDSTRING, 0, ByVal strItemText
    Next
    
'Show time in a label
    Label1.Caption = "API time : " & Format(Timer - dblTimer, "0.000") & " seconds"

End Sub

Download this snippet    Add to My Saved Code

Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a La Comments

No comments have been posted about Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a La. Why not be the first to post a comment about Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a La.

Post your comment

Subject:
Message:
0/1000 characters