|
-
Dec 27th, 2004, 03:14 PM
#1
Thread Starter
Lively Member
Autocomplete in combobox
Hi, I'm trying to make the same thing the addres text box of the internet explorer does. This is while you type it shows you what entries are like the one you are typing.
Any ideas? Somebody said something about using autocomplete... but haven't seen anything related to a combobox called autocomplete.
Thanks, folks!
Last edited by nacho2; Dec 27th, 2004 at 04:25 PM.
-
Dec 27th, 2004, 03:20 PM
#2
Re: Autocomplete in combobox
here is one written by some horrible coder named kleinma...
(even though it says Anonymous... thanks to plenderj )
http://www.freevbcode.com/ShowCode.Asp?ID=7007
it does autocomplete, but does not display the items below the combobox, like IE does...
-
Dec 27th, 2004, 04:25 PM
#3
Thread Starter
Lively Member
Re: Autocomplete in combobox
alright, great thanks!! I'll have a look. I don't understand how come that things so widely use in windows applications aren't already implemented in vb.
Thanks lots!
-
Dec 27th, 2004, 04:47 PM
#4
Re: Autocomplete in combobox
if you want to implement the AutoComplete that InternetExplorer uses ( eg: retrieve the web pages visited etc... ) you need to find the EDIT window of your ComboBox , then you can set the SHAutoComplete on it , eg:
VB Code:
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As IntPtr, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As IntPtr
Private Declare Sub SHAutoComplete Lib "shlwapi.dll" (ByVal hwndEdit As IntPtr, ByVal dwFlags As Int32)
Private Const SHACF_AUTOAPPEND_FORCE_ON As Int32 = &H40000000
Private Const SHACF_AUTOSUGGEST_FORCE_ON As Int32 = &H10000000
Private Const SHACF_URLHISTORY As Int32 = &H2
Private Const SHACF_URLMRU As Int32 = &H4
Private Const SHACF_URLALL As Int32 = (SHACF_URLHISTORY Or SHACF_URLMRU)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'/// first you need to find the EDIT part of the ComboBox
Dim ptr As IntPtr = FindWindowEx(ComboBox1.Handle, 0, "EDIT", Nothing)
If Not ptr.Equals(IntPtr.Zero) Then '/// it's found it.
SHAutoComplete(ptr, SHACF_AUTOAPPEND_FORCE_ON Or SHACF_AUTOSUGGEST_FORCE_ON Or SHACF_URLALL)
End If
End Sub
hope it helps
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|