Print Page | Close Window

Treeview TAG

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=18110
Printed Date: 23 April 2024 at 8:34am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Treeview TAG
Posted By: bartstoppel
Subject: Treeview TAG
Date Posted: 23 March 2011 at 5:28am
I'm using the XTreme SuitePro ActiveX 2009 Vol4 (13.4.0) with Vb.NET. I tried to store additional data in the TAG-field of a treeview node like in this example:

Structure testSTRUCT
        Dim numb As Integer
        Dim pics As Boolean
End Structure

Private Sub StoreDataToNode
        Dim tvnode As TreeViewNode
        Dim nodeData As testSTRUCT = New testSTRUCT

        nodeData.numb = 13123
        nodeData.pics = False
        tvnode = tvDemo.Nodes.Add(, , "F_1", "first node")
        tvnode.Tag = nodeData
End Sub
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
    StoreDataToNode()
End Sub

Running the program the debugger stops in the row "tvnode.Tag = nodeData"
But i got the error "Der Wert liegt außerhalb des erwarteten Bereichs" (e.g. in english "The value is outside the expected range") in the line "tvnode.Tag = nodeData" after  starting the program an clicking on the form.

However if i only store an integer in the tag-field of my treeview node (like this: tvnode.Tag = 1), the programm run through the line above without any error.

How can i store my additional data in the tag field?




Replies:
Posted By: Xander75
Date Posted: 23 March 2011 at 7:50am
Hi,

I believe this is due to the nature of what can be stored in the Tag field. Tag fields can store either a single boolean, integer, string and more values. However I don't think they can store a reference to an object, structure or type.

The best way would be to store your extra data in an array, then store the integer value of the array in the Tag field.


-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)


Posted By: bartstoppel
Date Posted: 23 March 2011 at 8:12am
Hi,

thanks for your reply. I'm a bit confused. The same way of proceeding to store additional data with VB-NET-structure in the tag-field operates in many different controls like microsoft treeview, microsoft listview, all purecomponents-controls, etc. without problems.

But for my software i need markups, so i have to use the codejock treeview not the microsoft one that doesn't support markups.

Perhaps i have to try your suggestion or i will do it with an collection to link the treeview node with the right collection item.


Posted By: Xander75
Date Posted: 23 March 2011 at 9:18am
Hi,

I must admit I am coming from a VB6 environment and not VB.Net.

However as a workaround the method I suggested would work fine in both instances to resolve your issue.


-------------
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)


Posted By: gibra
Date Posted: 23 March 2011 at 11:57am
Originally posted by bartstoppel bartstoppel wrote:

Hi,

thanks for your reply. I'm a bit confused. The same way of proceeding to store additional data with VB-NET-structure in the tag-field operates in many different controls like microsoft treeview, microsoft listview, all purecomponents-controls, etc. without problems.
 
Codejock controls are COM objects, aren't NET objects.
You can use them on NET environment, is true, but the behavoir still native (COM.
 
In your case, Tag property is a Text type, so you can store strings only. 
 
 


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8


Posted By: bartstoppel
Date Posted: 23 March 2011 at 1:14pm
thanks everybody for helping. 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net