|
-
Jun 22nd, 2006, 08:41 AM
#1
Thread Starter
Fanatic Member
[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
-
Jun 22nd, 2006, 08:55 AM
#2
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:
Private Declare Function ShellEx Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As Any, _
ByVal lpDirectory As Any, ByVal nShowCmd As Long) As Long
Private Sub Form_Load()
Dim tNode As Node
TreeView1.Nodes.Add , , "Websites", "Websites"
Set tNode = TreeView1.Nodes.Add("Websites", tvwChild, "www.yahoo.com", "www.yahoo.com")
tNode.Tag = "http://www.yahoo.com"
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
If Node.Tag <> "" Then
ShellEx Me.hwnd, "open", Node.Tag, "", "", 1
End If
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jun 22nd, 2006, 09:20 AM
#3
Thread Starter
Fanatic Member
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:
Sql=Select * from Author where Book like'"&sbook &"' and bdate='"&sdate &"'"
rs.open Sql,cn,adopenkeyset,adlockoptimistic
...
Set nodr = TreeView1.Nodes.Add(nodx, tvwChild, , rs!BookTitle)
note that nodx is the node containing the date of publication
Any help?
Thanks
-
Jun 22nd, 2006, 10:16 AM
#4
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
-
Jun 23rd, 2006, 01:25 AM
#5
Thread Starter
Fanatic Member
Re: hyperlink
Hi
the name of the field is BFile
-
Jun 23rd, 2006, 07:20 AM
#6
Re: hyperlink
so add this line:
VB Code:
Sql=Select * from Author where Book like'"&sbook &"' and bdate='"&sdate &"'"
rs.open Sql, cn, adopenkeyset, adlockoptimistic
...
Set nodr = TreeView1.Nodes.Add(nodx, tvwChild, , rs!BookTitle)
[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"
-
Jun 23rd, 2006, 08:32 AM
#7
Thread Starter
Fanatic Member
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
|