Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Displaying data in columns  (Read 441 times)

0 Members and 1 Guest are viewing this topic.

JKouba

  • Customer
  • Newbie
  • *
  • Offline Offline
  • Posts: 13
Displaying data in columns
« on: July 26, 2010, 07:59:20 PM »
I am developing in vb.net and have a lot of experience with vb6, although I am new to .net.

I am trying to create an app that is similar to an 'explorer' app but it looks into a document management system with cabinets, folders and documents.
I am trying to add data columns to each node with information for that object (cabinet, folder, document).  I capture the same information regardless of the object type (image, object name, owner name, modify date, version, etc).

I have created a set of node controls and columns in my tree.
My node is created as nodewithimage and I can get the image and the name in the tree with no problems.
I'm also able to associate the appropriate node control to the appropriate column.
I cannot seem to figure out, however, how to set the value of the column for each node except the image and name that is set with the node is created (e.g.):
           Cabinet = New NodeWithImage(strObjectName, My.Resources.dm_cabinet, strObjectID)
 
For each node how do I set my other nodecontrol/column values? 

Thanks!

Ruslan

  • Flexible TreeView Team
  • Sr. Member
  • *****
  • Offline Offline
  • Posts: 496
Re: Displaying data in columns
« Reply #1 on: July 27, 2010, 02:03:13 AM »
Hi,
 
Every data you see in the treeview is stored in the Node class instance. The NodeWithImage class has the Image property and the Text property, derived from the Node class. These properties you`ve used in your code:
 
Code: [Select]
Cabinet = New NodeWithImage(strObjectName, My.Resources.dm_cabinet, strObjectID)
Now, to add new data to display in the tree, you need to inherit your new node class from the NodeWithImage; add as many new properties as you need to display; add node controls for these new properties and bind them.
For example, we`ll add the ModifyDate property with DateTime type as you need:
 
Code: [Select]
Class CabinetNode  Inherits NodeWithImage
   Private m_ModifyDate As DateTime

   Public Property ModifyDate() As DateTime
      Get
         Return m_ModifyDate
      End Get
      Set
         m_ModifyDate = value
      End Set
   End Property  End Class

Now we`ll create the NodeDateTime node control to display our new ModifyDate property in the treeview:
 
Code: [Select]
Dim dateControl As New NodeDateTime()
dateControl.DataFieldName = "ModifyDate"
dateControl.AttachTo(tree)

Please note the line "dateControl.DataFieldName = "ModifyDate"" where we bind the node control to our new property. Also you need to set the ColumnId node control property to bind it to your column.

And as a final stage we`ll create and attach to the treeview our new node instance and fill all properties to display:
 
Code: [Select]
Dim node As New CabinetNode()
node.Text = "custom node"
node.Image = Resources.accept
node.ModifyDate = DateTime.Now   
node.AttachTo(tree)

JKouba

  • Customer
  • Newbie
  • *
  • Offline Offline
  • Posts: 13
Re: Displaying data in columns
« Reply #2 on: July 27, 2010, 05:24:21 PM »
Thank you. 
That explained it very well to me and I was able to get it working.

Ruslan

  • Flexible TreeView Team
  • Sr. Member
  • *****
  • Offline Offline
  • Posts: 496
Re: Displaying data in columns
« Reply #3 on: July 28, 2010, 03:40:10 AM »
For more information please see our Knowledge Base.
 

Copyright © 2006-2012 ARMSoft. All rights reserved.