Results 1 to 7 of 7

Thread: [RESOLVED] hyperlink

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2006
    Posts
    977

    Resolved [RESOLVED] hyperlink

    Hi
    I have a treeview with multiple nodes.When the user clicks on a specific child node,I want to include a hyperlink to "www.yahoo.com".

    My first question is what's the event that detect that a child node has been clicked.
    My second question is how can I include a hyperlink to a childnode's text

    Any help would be appreciated

    Thanks

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: hyperlink

    you cant include a hyperlink... but what u can do is set the nodes tag property to the real URL. the call that on the NodeClick event... (Using ShellEx API to launch the URL)

    VB Code:
    1. Private Declare Function ShellEx Lib "shell32.dll" Alias _
    2. "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
    3. ByVal lpFile As String, ByVal lpParameters As Any, _
    4. ByVal lpDirectory As Any, ByVal nShowCmd As Long) As Long
    5.  
    6.  
    7. Private Sub Form_Load()
    8.    Dim tNode As Node
    9.     TreeView1.Nodes.Add , , "Websites", "Websites"
    10.     Set tNode = TreeView1.Nodes.Add("Websites", tvwChild, "www.yahoo.com", "www.yahoo.com")
    11.     tNode.Tag = "http://www.yahoo.com"
    12. End Sub
    13.  
    14.  
    15.  
    16. Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
    17.     If Node.Tag <> "" Then
    18.         ShellEx Me.hwnd, "open", Node.Tag, "", "", 1
    19.     End If
    20. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2006
    Posts
    977

    Re: hyperlink

    Hi Static
    I want to explain to you my problem:
    I have a tree view that looks like:
    Author
    Books(written by this author)
    Date of Publication
    Title of the book
    When the user clicks on the Title of the book,i want to show the cover of the book which is saved in the local disk(C:\Covers),how can i include a hyperlink into the title of the book(note that I obtain the title of the book from an SQL query
    VB Code:
    1. Sql=Select * from Author where Book like'"&sbook &"' and bdate='"&sdate &"'"
    2. rs.open Sql,cn,adopenkeyset,adlockoptimistic
    3. ...
    4. Set nodr = TreeView1.Nodes.Add(nodx, tvwChild, , rs!BookTitle)

    note that nodx is the node containing the date of publication

    Any help?
    Thanks

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: hyperlink

    What's the name of the field in the table that has the name of the file that's the picture of the cover?
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2006
    Posts
    977

    Re: hyperlink

    Hi
    the name of the field is BFile

  6. #6
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: hyperlink

    so add this line:

    VB Code:
    1. Sql=Select * from Author where Book like'"&sbook &"' and bdate='"&sdate &"'"
    2. rs.open Sql, cn, adopenkeyset, adlockoptimistic
    3. ...
    4. Set nodr = TreeView1.Nodes.Add(nodx, tvwChild, , rs!BookTitle)
    5. [B]nodr.tag = rs!Bfile[/B]
    now.. how do you want to display the image?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2006
    Posts
    977

    Re: [RESOLVED] hyperlink

    Thanks Static

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