|
-
Aug 12th, 2000, 04:53 AM
#1
Thread Starter
Member
I need to cycle through all my open forms and update the Treeview to reflect changes I have made in any one of the other forms. i.e. if I move a node on instance(1) of Form1 I need the other instances of that form to update their Treeview to look the same. I tried the following code but it doesn't work !!!
-----------------------------------------------------------
Public Sub ChangeParent(SelectedNode as Node,NewParentNode as Node)
Dim nNode As Node
Dim m_Form as Form
On Error GoTo ErrorTrap
For Each m_Form In Forms
If IsObject(m_Form.Controls("tvEquipView")) Then
Set nNode = m_Form.Controls("tvequipview").Nodes(SelectedNode).parent = NewParentNode.Key
End If
NextForm:
Next
Out:
Exit Sub
ErrorTrap:
If Err.Number = 730 Then Resume NextForm
MsgBox Err.Description, vbCritical + vbOKOnly
Resume 'Out
End Sub
-----------------------------------------------------------
Does anyone have any ideas. I think I may be looking for an API call to do what I need.
Forever hopeful.........
-
Aug 15th, 2000, 02:53 AM
#2
Thread Starter
Member
Come on Guys & Gals
I posted this last week and it has had seven reads. (I think I was two of them) Surely someone out there knows the answer!
I think the reference to the passed node is directly related to the form it originated on, cos the code shown actually creates multiple instances of the same node on the origin form for each form it steps through.
It's driving me crazy.
-
Aug 15th, 2000, 05:40 PM
#3
Frenzied Member
Trouble with nodes is that you pretty have to figure out stuff for yourself.
I think I'd take a slightly different approach (although in my _one_ node application, the user can't change the entries in the tree).
First, I'd issue a clear on the tree you're going to synch, then I'd loop thru the source tree, setting the appropriate values, like:
tvwNodetree.Nodes.Add( , , NodeKey, nodename)' for topmost entries and
tvwNodetree.Nodes.Add(nodelevel, tvwChild, nodename, nodename ) ' for everything else
-
Aug 15th, 2000, 07:46 PM
#4
Thread Starter
Member
Hmmmmmmmmm !!! I was so excited when I saw I had an answer this morning. Thanks for the post JHausmann, but it doesn't help me. I am linked to a large database with deep tree levels. It would seriously slow down the App. if I were to rebuild the TreeView each time a Node was moved. I don't want to revert to a single form solution as users need to be able to drag/drop from one form to another etc. etc.
I will put a reference to this post in the API section to see if the answer lies there.
-
Aug 17th, 2000, 08:01 PM
#5
Thread Starter
Member
JHausmann, you asked for more detail of what I'm trying to do, well as an everyday example of what I'm trying to achieve......
Start two or more instances of Explorer and lets pretend you have a couple of directories in the root (C:\) level. Directory1 & Directory2. You can obviously see them in all instances of explorer and if you were to move Directory1 into Directory2 you would see the change reflected in all open explorer windows.
Well that's what I'm trying to do in my 'Enginering Design Project' I can have multiple forms with treeviews looking at the same (or different data) and if the user moves a piece of equipment (Node) I need the other forms/treeviews to reflect the changes.
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
|