|
-
May 25th, 2005, 08:38 AM
#1
Loop through Treeview and print...[Resolved]
For X = 1 To frmMain.tvInstalled.Nodes.Count
Printer.Print frmMain.tvInstalled.Nodes(X).Text
DoEvents
Next
this works.. sort of.
What I need is to print the nodes in order with an appropriate indent..
Looping the above way does not print the nodes out the same as you see them
loops through each "level" instead of top to bottom...
Last edited by Static; May 25th, 2005 at 09:05 AM.
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
May 25th, 2005, 08:45 AM
#2
Re: Loop through Treeview and print...
Is this for documentation purposes? If so, then why not just take a screen shot and print that?
(I ask this question because I had to do this once for a project.)
-
May 25th, 2005, 08:50 AM
#3
Re: Loop through Treeview and print...
Screenshot doesnt capture all items..
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
May 25th, 2005, 09:04 AM
#4
Re: Loop through Treeview and print...
Got it.. found this little bit of code on the web 
tweaked it for printing...
VB Code:
Public Sub PrintTree(objNode As Node)
Static Indent As Integer
Dim objSiblingNode As Node
Set objSiblingNode = objNode
Do
Printer.CurrentX = Indent
Printer.Print objSiblingNode.Text
If Not objSiblingNode.Child Is Nothing Then
Indent = Indent + 500
Call PrintTree(objSiblingNode.Child)
End If
Set objSiblingNode = objSiblingNode.Next
Loop While Not objSiblingNode Is Nothing
Indent = Indent - 500
If Indent < 0 Then Indent = 0
End Sub
Private Sub Usage()
Call PrintTree(Treeview1.Nodes(0))
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
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
|