473,386 Members | 1,699 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,386 software developers and data experts.

Treeview control - duplicate keys

MS Access 2000

I have created a large treeview control based on lists of parts. The
nodekey for a part consists of a character followed by the parent
part's index. Some of these parts (e.g., screws) will show up many
times in the same relative position in the treeview. How can I avoid
getting duplicate key error messages? Here's a simplified version of
my treeview control:

Widget 1
Frob a
Frob b
Screw 1
Screw 2
Widget 2
Frob b
Screw 1
Screw 2
Widget 3
Frob a
Frob c
Screw 2
Screw 3

I have tried incrementing the character in front of the part's index
each time I call the recursive subroutine to create a new branch, and
it seems to work, but only to the second level of parts (in my sample
above, the "Frobs" are fine, but not the screws).

Jun 12 '07 #1
2 3563
On Mon, 11 Jun 2007 19:03:53 -0700, Je************@comcast.net wrote:

I have dealt with the same issue by assigning the key as the
concatenation of the various levels it is in. I used a
querystring-like format, e.g.:
Widget 1: w=1
Widget 1 - Frob a: w=1&f=a
Widget 1 - Frob b - Screw 1: w=1&f=b&s=1

Then write a few functions to pick apart the "querystring" (I used a
scripting.dictionary object) and test if a certain element exists.
A key like this comes in very handy when for example the user clicks
on a Screw 1 object: you immediately know what this object is a part
of, without walking the tree.

-Tom.
>MS Access 2000

I have created a large treeview control based on lists of parts. The
nodekey for a part consists of a character followed by the parent
part's index. Some of these parts (e.g., screws) will show up many
times in the same relative position in the treeview. How can I avoid
getting duplicate key error messages? Here's a simplified version of
my treeview control:

Widget 1
Frob a
Frob b
Screw 1
Screw 2
Widget 2
Frob b
Screw 1
Screw 2
Widget 3
Frob a
Frob c
Screw 2
Screw 3

I have tried incrementing the character in front of the part's index
each time I call the recursive subroutine to create a new branch, and
it seems to work, but only to the second level of parts (in my sample
above, the "Frobs" are fine, but not the screws).
Jun 12 '07 #2
I was afraid you were going to suggest this. I have been trying to do
this, with mixed results -- but I recently found that some of the
parts I'd been given had circular references! Thanks for the advice,
I'll slog through it and once I get the data cleaned up, hopefully
this will work.

Regards,

Jenifer
On Jun 12, 12:44 am, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On Mon, 11 Jun 2007 19:03:53 -0700, Jenifer.Aus...@comcast.net wrote:

I have dealt with the same issue by assigning the key as the
concatenation of the various levels it is in. I used a
querystring-like format, e.g.:
Widget 1: w=1
Widget 1 - Frob a: w=1&f=a
Widget 1 - Frob b - Screw 1: w=1&f=b&s=1

Then write a few functions to pick apart the "querystring" (I used a
scripting.dictionary object) and test if a certain element exists.
A key like this comes in very handy when for example the user clicks
on a Screw 1 object: you immediately know what this object is a part
of, without walking the tree.

-Tom.
MS Access 2000
I have created a large treeview control based on lists of parts. The
nodekey for a part consists of a character followed by the parent
part's index. Some of these parts (e.g., screws) will show up many
times in the same relative position in the treeview. How can I avoid
getting duplicate key error messages? Here's a simplified version of....
Jun 12 '07 #3

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

Similar topics

0
by: Mike Preston | last post by:
Warning - long message. Many thanks for making the A97 version of the treeview w/o activex controls available. I have taken it down a different path and ended up doing almost everything...
1
by: kidzero | last post by:
Hello, Is there any easy way to control treeview selection ? For example if user pushes button "next" treeview control selects next node. if user pushes button "prev" treeview control selects...
0
by: meh | last post by:
I have a treeView that I'm trapping key strokes like below. It works fine as long as I dont define shortcut keys in the Context Menu assigned to the treeView for those keys. Can someone tell me...
8
by: Hrvoje Voda | last post by:
What is wrong in this code? private void tree_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter ) {
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...
2
by: Kristopher Wragg | last post by:
I'm having some serious problems with the TreeView control. I've got a control that inherits TreeView and has some methods that firstly create a TreeNode then does some recursive procedure to add...
2
by: Luqman | last post by:
I am using VB.Net 2005 and I want to fill the Tree View with Oracle Scott/Tiger Table which contains Parent/Child keys in one table, how can I ? In VB-6, I used TreeView Key while in VB.Net 2005,...
3
by: rolf.oltmans | last post by:
Hello, I need to populate a TreeView control from SortedList(Winforms application). I've stored ID's as key and Nodes as value. A typical TreeView in my case would like like 1 Goal 1.1 Task1...
2
by: casManG | last post by:
I am working on a small project that uses the treeview control in .net 2003. I have a tree view that I am sending to a sub in order to iterate through the nodes. Public Sub test (ByVal...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.