473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Treeview: Drag'n drop and parent/children relation

L.M
Hello,

When doing a drag'n drop of a node in a treeview, is there an easy way to
make sure that the destination is not a children (at any level) of the
source ?

Root:
- A
- B
- C
- D

Like moving D on B is good, but moving B in D is not.
I discovered that moving A anywhere in the tree bellow it just make
everything disapeared.

I was thing to check that with the node.FullPath property, but was wondering
if there wasn't anything more easey or already implemented.

L.
Nov 21 '05 #1
3 1674
FullPath property sounds good it would be a simple check
From your example

sourcePath = "\A\B\C\D"
destinationPath = "\A\B"

If Instr(sourcePath, destinationPath) =1 Then
' Good
Else
' No can do
End If

"L.M" <nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

When doing a drag'n drop of a node in a treeview, is there an easy way to
make sure that the destination is not a children (at any level) of the
source ?

Root:
- A
- B
- C
- D

Like moving D on B is good, but moving B in D is not.
I discovered that moving A anywhere in the tree bellow it just make
everything disapeared.

I was thing to check that with the node.FullPath property, but was wondering if there wasn't anything more easey or already implemented.

L.

Nov 21 '05 #2
L.M
That make it perfectly, Thanks.
Isn't VB provide a call to check if any node is part of the path ? I was
thinking so....
"solex" <so***@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
FullPath property sounds good it would be a simple check
From your example

sourcePath = "\A\B\C\D"
destinationPath = "\A\B"

If Instr(sourcePath, destinationPath) =1 Then
' Good
Else
' No can do
End If

"L.M" <nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

When doing a drag'n drop of a node in a treeview, is there an easy way to make sure that the destination is not a children (at any level) of the
source ?

Root:
- A
- B
- C
- D

Like moving D on B is good, but moving B in D is not.
I discovered that moving A anywhere in the tree bellow it just make
everything disapeared.

I was thing to check that with the node.FullPath property, but was

wondering
if there wasn't anything more easey or already implemented.

L.


Nov 21 '05 #3
LM,
There is no method I know of that would tell you this, except for
recursively iterating through a collection of nodes to determine if the node
you are trying to copy is a descendant of the parent. IMHO the method below
seams to be very simple and quick.
Dan

"L.M" <nospam> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
That make it perfectly, Thanks.
Isn't VB provide a call to check if any node is part of the path ? I was
thinking so....
"solex" <so***@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
FullPath property sounds good it would be a simple check
From your example

sourcePath = "\A\B\C\D"
destinationPath = "\A\B"

If Instr(sourcePath, destinationPath) =1 Then
' Good
Else
' No can do
End If

"L.M" <nospam> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,

When doing a drag'n drop of a node in a treeview, is there an easy way to make sure that the destination is not a children (at any level) of the
source ?

Root:
- A
- B
- C
- D

Like moving D on B is good, but moving B in D is not.
I discovered that moving A anywhere in the tree bellow it just make
everything disapeared.

I was thing to check that with the node.FullPath property, but was

wondering
if there wasn't anything more easey or already implemented.

L.



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: EggHead | last post by:
Hi all, I am trying to implement Drag and Drop with my TreeView Control. The problem is, when I click on a node, drag it, and drop it to other node. The dropped node does not hold the drop...
1
by: ahaideb | last post by:
I have a table (relation) in my database: --------------- | parent | child | --------------- | 1 | 2 | | 1 | 3 | | 2 | 4 | | 2 | 5 ...
1
by: PeteCresswell | last post by:
I'm doing a metadata app. One of the screens is a TreeView of all the codes (i.e. allowed values) from various systems. Other screens list systems, databases, tables, and elements (i.e....
5
by: JamesT | last post by:
Is it me or has the VB.NET Treeview control gone back to the darkages. I am trying to update a VB6 programme that uses the treeview control a lot- there are 4 treeview controls which are...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
2
by: MaPet | last post by:
He. I'm trying to create a treeview that will show data from access database in hierarchical way. Database structure is: ID, FirstName, LastName, IDBoss - IDBoss is referenced to ID. Treeview...
8
by: Rick | last post by:
VS 2005 I' m setting up a parent/child datagridviews in a form. I am doing a lot of this by hand coding in order to get the feel of things. I want a change in the parent table to trigger a...
4
by: jmDesktop | last post by:
I have searched everywhere and tried several things. I have a treeview with and want to be able to only select a parent node. For example: root //don't want to drag this -parent1 //yes, drag...
3
by: dutsnekcirf | last post by:
I have a treeview control on a custom task pane in Excel. I've enable the ability to use Drag & Drop (by following this how-to) on the treeview to change the order of the nodes. The problem though...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.