Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Treeview TAG
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Treeview TAG

 Post Reply Post Reply
Author
Message
bartstoppel View Drop Down
Newbie
Newbie


Joined: 23 March 2011
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote bartstoppel Quote  Post ReplyReply Direct Link To This Post Topic: Treeview TAG
    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?

Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 348
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
bartstoppel View Drop Down
Newbie
Newbie


Joined: 23 March 2011
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote bartstoppel Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 348
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
gibra View Drop Down
Senior Member
Senior Member
Avatar

Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 273
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post 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 17.x
Windows 10 64bit
VS2017 - VB6.0 SP6
VS/VB 6.0 Installer v4.8 for Windows
Back to Top
bartstoppel View Drop Down
Newbie
Newbie


Joined: 23 March 2011
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote bartstoppel Quote  Post ReplyReply Direct Link To This Post Posted: 23 March 2011 at 1:14pm
thanks everybody for helping. 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.063 seconds.