Avoiding Bound Controls
SelectItemSilent - a brief description...
This function is virtually identical to SelectItem, except that this version does not generate a Click event with the change in selection. When this might be useful to you I do not know, but here it is.
Sub SelectItemSilent (lstX As Control, ByVal sSelect As String)
Dim iPos As Long
' This sub is called silent as it does not generate a
' Click event.
' Clear the current selection so we have nothing
' selected if the item is not found
lstX.ListIndex = -1
' Search for the exact string in the ListBox or Combo
' and select it when found. The API does the work
If TypeOf lstX Is ComboBox Then
iPos = BIND_SendMessageString(lstX.hWnd, BIND_CB_SELECTSTRING, -1, sSelect)
Else
iPos = BIND_SendMessageString(lstX.hWnd, BIND_LB_SELECTSTRING, -1, sSelect)
End If
End Sub
![]()