473,672 Members | 2,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help Converting from Treeview 5 to Treeview 6

Hi

I have changed the control in my form to a Treeview 6 instead of 5 and
my code no longer works as before. Can anybody help me here.

There are no errors, but I only end up with the first entry (parent)
showing and nothing happens with my NodeClick events either.

Here is the code to add branches to the tree (taken from somewhere and
adapted):-

Sub AddBranch(rst As DAO.Recordset, strPointerField As String,
strIDField As String, strTextField As String, Optional varReportToID As
Variant)
On Error GoTo errAddBranch
Dim nodCurrent As Node
Dim objTree As TreeView
Dim strCriteria As String
Dim strText As String
Dim strKey As String
Dim nodParent As Node
Dim bk As String
Set objTree = Me.ActiveXCtl27 .Object
'Set objTree = Me.TreeCtrl2.Ob ject - old version 5 object

If IsMissing(varRe portToID) Then ' Root Branch.
strCriteria = strPointerField & "=0"
Else ' Search for records pointing to parent.
strCriteria = BuildCriteria(s trPointerField,
rst.Fields(strP ointerField).Ty pe, "=" & varReportToID)
Set nodParent = objTree.Nodes(" a" & varReportToID)
End If

' Find the first emp to report to the boss node.
rst.FindFirst strCriteria

Do Until rst.NoMatch
' Create a string with LastName.
strText = Nz(rst(strTextF ield), "BLANK")
strKey = "a" & rst(strIDField)
If Not IsMissing(varRe portToID) Then 'add new node to the parent
Set nodCurrent = objTree.Nodes.A dd(nodParent, tvwChild, strKey,
strText)
Else ' Add new node to the root.
Set nodCurrent = objTree.Nodes.A dd(, , strKey, strText)
End If

' Save your place in the recordset so we can pass by ref for speed.
bk = rst.Bookmark
' Add employees who report to this node.
AddBranch rst, strPointerField , strIDField, strTextField,
rst(strIDField)
rst.Bookmark = bk ' Return to last place and continue search.
rst.FindNext strCriteria ' Find next employee.
Loop

exitAddBranch:
Exit Sub
errAddBranch:
MsgBox "Error: " & Err.Number & " " & Err.Description
End Sub

Many thanks
Marian

Nov 13 '05 #1
0 1164

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

Similar topics

5
1883
by: fgh | last post by:
Hello, two questions please: 1) In a treeview, I want to display folders like it is done in Windows Explorer. Do I have to do this manually or can I set something up in VS.NET 2003? 2) Most importantly, in Windows Explorer, you can drag the treeview's right edge to resize it to your will. How can I do this with my treeview (at runtime obviously)? Do I need to use a splitter? Any info would be appreciated very much.
3
4706
by: serge calderara | last post by:
Dear all, I ma collected data from a CSV file and build dataset based on those data. I would like to bind this dataset to a treeview control in order that nodes gets displayed automatically based on my dataset column name. Does anyone could help me how to do this ? Any sample will be appriciate best regards
3
2180
by: serge calderara | last post by:
Dear all, I have a csv file data which has been read and populate on a dataset object. then I need to bind part of the content of the dataset to a treeview control. I have read that XML format is particular usefull to be bind to a treeview as it handle nodes. So I have try to save my dataset content into a xml file. The content of that file is as follow : - <NewDataSet> - <REC_INFO>
12
1548
by: serge calderara | last post by:
Dear all, I have a function that I need to run in a thread due to the fact that it can takes long time to execute according to the amount of data to collect. This function is also populating a treeview control whne collected data gets finished. In order to achieve this I have used the following code : System.Threading.ThreadPool.QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf GetListOfReelsFromRemoteDB))
10
2824
by: Brian | last post by:
I'm reasonably new to C#, and using a class containing a hashtable collection to feed a treeview. My problem is that I can't pull the data from the hashtable! Here's the code I have: if (myItem.DataFields.Count != 0) foreach (string name in myItem.DataFields.Values) { treeView1.SelectedNode.Nodes.Add (name); // Error on this line }
1
1170
by: needin4mation | last post by:
Hi, I am using C# in asp.net. I have my treeview control from my built ..dll on my toolbox. I can drop it on the webpage. What I cannot do is reference treeview objects from the codebehind form. I can see: protected Microsoft.Web.UI.WebControls.TreeView TreeView1; But as soon as I try something like:
1
1384
by: Macca | last post by:
Im am writing an application that will looks similar to Outlook or a help file, i.e tree structure on left with right hand side pane showing data. It is split into two panes.The Left pane has a treeview. When the nodes in the tree are selected data is shown in the right pane. I am using a treeview in the left pane and was wondering what is the best way to show the data being selected in the right pane. It's been suggested i use a panel...
2
1542
by: DJG | last post by:
I need some help with a TreeView control in VB.Net I've got a datatable with about 8000 rows. 500 are 'folders', and the other 7500 rows are 'jobs'. It's a logical representation of some data, and not a physical drive. Each row has: master_key (unique id) folder_name (name for the user to see) parent_key (the master_key of the parent folder)
3
1629
by: William Sullivan | last post by:
I desperately want to replace my hand-made ajax treeview with the 2.0 TreeView. The webpage I'm designing uses the postbacks to dynamically fill the treeview. The reason why I'm doing this is because my tree is ENORMOUS. It can possibly hold millions of nodes. The problem is keeping this treeview constrained as a user clicks through the nodes. I've tried putting it in a DIV with a set width and height, but the problem is that when you...
0
8418
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8943
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8841
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8635
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8695
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6254
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5719
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2087
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.