Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieving URL

Status
Not open for further replies.

d0s

Programmer
Apr 15, 2004
48
US
Hey, Im building a Web Browser and everything is working great, but i want to retrieve the exact URL to save in the file to input into the combobox on load. Anyone know how to retrieve the URL as in site.com/index or site.com/directory/file.wutever? Thanks
 
The code snippet below retrieves Name and URL for a file in Favorites folder

Code:
Dim Name As String
Dim Url As String

Dim fileInf As FileInfo = New FileInfo("F:\Documents and Settings\pbanga\Favorites\Forums\Tek-Tips Forums for computer professionals.url")

Name = fileInf.Name.Substring(0, fileInf.Name.Length - fileInf.Extension.Length)

'Open the file.
Dim stream As New FileStream(fileInf.FullName, FileMode.Open)
Dim reader As New StreamReader(stream)

'go through each line.
Do While True

'get a line.
Dim buf As String = reader.ReadLine
    If buf Is Nothing Then Exit Do

    'does the string starts with "url="
    If buf.StartsWith("URL=") Then

        'set the url.
        Url = buf.Substring(4)

        'quit.
        Exit Do
    End If
Loop

MessageBox.Show(Name)
MessageBox.Show(Url)

'close file.
reader.Close()
stream.Close()

hope this helps

 
Yea i think i could use that...have to do a little changing but yea..thanks alot!!
 
ok i better ask before i just go nuts lol...As stated above im making a web browser. Basically im making it like IE, but different options ect.. but want to have some of the same functions as IE. What im wanting to do is when they type in the URL in the combo box and hit enter, it'll save it to my templist.hh file(which is already coded and works), but i want all the links to load into the combo box onload but without entering 2 of the same exact urls. And my question from above is if i click on a link on a website, is there a way i have to where when it goes to the destination link that it updates the comobox text with the exact URL? im going to attempt to do this with teh code above, with changes of course but any help would be great...Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top