- Home
·
- Miscellaneous
·
- Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a La
Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a La
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
(2(2 Vote))
'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
Add 1000 numbers in less than 0.07 seconds to a ComboBox/ListBox and show transmission time in a La Comments
No comments yet — be the first to post one!
Post a Comment