[Copied from the cool things you can do page]
 
Declare "Function SendMessageStr Lib ""Coredll"" Alias ""SendMessageW"" 
(ByVal HWND As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal 
lParam As String) As Long"

Dim bReset

Const CB_FINDSTRING = &H14C
Const CB_FINDSTRINGEXACT = &H158
Const CB_SETEDITSEL = &H0142

sub combobox_change
    if bReset then exit sub 'prevents endless loops
    bReset = true
    getIdx "combobox"
    bReset = false
end sub

sub getIdx(ctrl)
   Dim idx
    'finds the idx of the exact match (case insensitive)  inside the 
combobox.List
   Execute "idx = sendMessageStr(" & ctrl & ".hwnd, CB_FINDSTRINGEXACT, 0 , " & 
ctrl & ".Text)"
   If idx > -1 Then 'only assign when match found otherwise constantly 
resetting to -1
      Execute ctrl & ".Listindex = " & idx 'setting the ListIndex causes the 
box to select all text
     'following turns off text selection inside control
      Execute "SendMessageStr " & ctrl & ".hwnd, CB_SETEDITSEL, 0, -1"
   End If
end sub


Woody
Wizard, at large
"I'm in shape, round is a shape!"
 

--- On Tue, 3/23/10, [email protected] <[email protected]> wrote:


From: [email protected] <[email protected]>
Subject: [nsbasic-ce] Re: Combo Box search
To: [email protected]
Date: Tuesday, March 23, 2010, 11:37 AM


  



there is no listcount or list property with a combo box :(

--- In nsbasic...@yahoogro ups.com, Andrew Thomas <andrewmarkthomas@ ...> wrote:
>
> Hi,
> 
> Have you tried using a for loop with something like:
> 
> For index=0 to mylist.listcount
> Var=mylist.List( index)
> next
> 
> Best wishes,
> 
> Andrew.
> 
> 
> 
> 
> 
> -----Original Message-----
> From: bigp...@... <bigp...@... >
> Sent: 23 March 2010 17:57
> To: nsbasic...@yahoogro ups.com
> Subject: [nsbasic-ce] Combo Box search
> 
> Is it possible to search the list of a combo box for a specific String or 
> input from a textbox value? If so how would you do this?
>






-- 
You received this message because you are subscribed to the Google Groups 
"nsb-ce" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en.

Reply via email to