When I need to get them, I do that
ComboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend
ComboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.AllUrl
I don't know, what done behind the scene, but your question will le me work around this, thanks a lot :)
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Play with registry... and I assumed it as Windows-based application.
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
What's interesting here, is that both methods are pretty great..... but neither one of them gets the typed URL's of a browser other than IE. What about getting the history of Firefox.... Opera.... Chrome?
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Well, That code works... And Pretty Well.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
You would have to do something entirely different. Firefox stores it's URL's in files.... I believe under something like "c:\documents and settings\%username%\Application Data\Mozilla\Firefox\Profiles\\history.dat" although now, I think they store it in an sqlite database (same path), making it that much more complicated to read.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
That code is fantastic. The only thing that I would mention about it... is that you are using the function to work with your form. On a small scale project, this is fine (and I've seen it used on large scale projects too), but keep in mind that this defeats the entire purpose of a function. Why even use a function... why not put all that code in the Button1_Click Event? The function is meant to be used to GET the list of URL's.... actually displaying them to the user is a different process... a different concept. So getting the data, and showing the data should not be combined.
Imports System
Imports Microsoft.Win32
Imports System.Windows.Forms
Public Class Form1
Public Function PopulateUrlList() As List(Of String)
Dim regKey As String = "Software\Microsoft\Internet Explorer\TypedURLs"
Dim subKey As RegistryKey = Registry.CurrentUser.OpenSubKey(regKey)
Dim url As String
Dim urlList As New List(Of String)()
Dim counter As Integer = 1
While True
Dim sValName As String = "url" + counter.ToString()
url = DirectCast(subKey.GetValue(sValName), String)
If DirectCast(url, Object) Is Nothing Then
Exit While
End If
urlList.Add(url)
counter += 1
End While
Return urlList
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dim urls as new List(of string)()
dim I as integer
urls = PopulateUrlList()
for I = 0 to urls.count -1 ' maybe i = 1 to urls.count
ComboBox1.Items.Add(url)
next I
End Sub
End Class
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
No No, It was faulty code :$:
dim urls as new List(of string)()
dim I as integer
urls = PopulateUrlList()
for I = 0 to urls.count -1 ' maybe i = 1 to urls.count
ComboBox1.Items.Add(urls(i)) ' // oops!
next I
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215