Results 1 to 5 of 5

Thread: Hyperlinks

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Location
    Leicester, England (City of Kings)
    Posts
    156

    Hyperlinks

    Hello Boys & Girls.

    My problem today comes in displaying a hayperlink from my database and returning a hyperlink to my database.

    The idea behind this is that when I create a file or folder on my computer that is relevant to my database, I want to be able to add the hyperlink for it to my database.

    What I'd like therefore is to know whether or not I use a textbox to display hyperlinks in a vb programs or whether there's a specific box that deals with hyperlinks.

    Also, when It comes to adding an hyperlink, I'd like to be able to search for the relevant place on my computer from vb & then return that hyperlink to the database using .edit or .addnew

    Thanks

    Sam

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Store the path to the file you need in the database. Then you can use a label to display that file. To make it a hyperlink, use the following code:
    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" _
    2. Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal _
    3. lpOperation As String, ByVal lpFile As String, ByVal _
    4. lpParameters As String, ByVal lpDirectory As String, _
    5. ByVal nShowCmd As Long) As Long
    6.  
    7. Private Const SW_SHOWNORMAL = 1
    8. Private Sub ExecuteFile(FilePath As String)
    9.     ShellExecute Me.hwnd, vbNullString, FilePath, vbNullString, "C:\", SW_SHOWNORMAL
    10. End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Location
    Leicester, England (City of Kings)
    Posts
    156
    Thanks for that.

    I've one small question. I'm already using a recordset to display the information that I want. I'd like to get the label or textbox to recognise that this particular column of the recordset holds hyperlinks & that it should display them. How can I do this using the recordset I have rather than by creating a new connexion?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    How about parsing the recordset element that holds the hyperlink. If the first seven characters are http:// then you know it is a hyperlink.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Location
    Leicester, England (City of Kings)
    Posts
    156
    I'm not quite sure I understand, Hack. Could you flesh your answer out a little more as I'm fumbling in the dark a bit, being new to this game.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width