April 25, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

VB TIP: Using Auto Complete

  • November 18, 2002
  • By Karl Moore
  • Send Email »
  • More Articles »

One of the latest user interface fads is AutoComplete, a feature Microsoft introduced with Internet Explorer 5.

Since it's birth, numerous Visual Basic sites have attempted to duplicate such functionality by using special combo box algorithms, API search procedures and such like. This code snippet doesn't. Instead, it uses the exact same API call as the software giant.

That means you can simplify the typing of Web addresses, automatically complete file and folder names, plus display command lines tapped direct into the Run menu — all with the use of this special function.

To use this code snippet, simply add a Text Box to your Form, then call the MakeAutoComplete method, passing your Text Box as an argument.

Note: This code requires Internet Explorer 5 to work. To check whether your user has Internet Explorer 5 installed, use the code tip here.

Usage

Call MakeAutoComplete(Text1)

Code

Private Declare Function SHAutoComplete _
   Lib "Shlwapi.dll" _
  (ByVal hwndEdit As Long, _
   ByVal dwFlags As Long) As Long

Private Const SHACF_DEFAULT  As Long = &H0

Public Sub MakeAutoComplete(ByRef TextB As TextBox)

    Call SHAutoComplete(TextB.hWnd, SHACF_DEFAULT)

End Sub





Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel