|
-
Aug 18th, 2002, 09:12 PM
#1
Thread Starter
Member
AutoComplete In VB.Net, Please...
Sunday, August 18, 2002
Dear Geniuses
I was trying to accept auto complete feature to a Visual Basic.Net textbox. I used the SHAutoComplete Api function as the following code snippet. The function returned S_OK but nothing happened. Please let me know what I’ve done wrong.
Private Const SHACF_URLHISTORY As Integer = &H2
Private Const SHACF_AUTOSUGGEST_FORCE_ON As Integer = &H10000000
Private Declare Auto Function ShAutoComplete Lib "shlwapi" Alias "SHAutoComplete" (ByVal hwnd As Integer, ByVal dwFlags As Integer) As Integer
Private Sub Whatever()
Me.ShAutoComplete(Me.myTextBox.Handle.ToInt32, SHACF_URLHISTORY Or SHACF_AUTOSUGGEST_FORCE_ON)
End Sub
Thanks for your time.
-
Aug 20th, 2002, 08:50 PM
#2
Thread Starter
Member
Solved!
Hey folks
With thanks from Mr. Tom Shelton <[email protected]> of the MSDN's newsgroups the problem solved! I think I'm the first stupid person that answer my question myself, but I thought that it might be useful for you.
To provide auto complete feature for an edit control (a TextBox or edit portion of a ComboBox) you can use 'SHAutoComplete' api call from 'shlwapi.dll' as the following:
Private Const SHACF_AUTOSUGGEST_FORCE_ON As Integer = &H10000000
Private Const SHACF_AUTOAPPEND_FORCE_ON As Integer = &H40000000
Private Const SHACF_URLHISTORY As Integer = &H2
Private Declare Function SHAutoComplete Lib "shlwapi.dll" (ByVal hwndEdit As IntPtr, ByVal dwFlags As Integer) As Integer
Private Sub SomeSub
Me.SHAutoComplete(Me.myTextBox.Handle , SHACF_URLHISTORY Or SHACF_AUTOSUGGEST_FORCE_ON)
End Sub
After the calling of 'SomeSub' as you - or your App's user - type in myTextBox, if your typed string is similar to one of urls in user's history, a popup window will appear loaded with all appropriate urls for the user, same as the Internet Explorer's address bar. Too cool! Check it out. There are too more options that you can accept to your TextBox, such as providing local files as history urls or favorites links, to see those options (Constants that you can use as flags) see Platform SDK in MSDN part of your .Net documentation.
Good Luck.
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
|