INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Visual Basic .net - Tree View  (Read 2928 times)

nila

  • Guest
Visual Basic .net - Tree View
« on: February 02, 2004, 05:09:44 pm »

Hey ;)
Just installed VB .net and tryin to get to grips with it.
The tree view is the most basic thing I'm having problems with?

I can work out how to add root level items:
treeview.nodes.add("blah")

and child nodes to that root level item:
treeview.nodes(0/1/2/etc).nodes.add("blah2")


But I cant for the life of me work out how to add nodes to that child??
or to it's childrens children etc??


Also, with VB6 there was the drop down menu to chose events 'MouseOver', 'MouseDown' etc.

How are these chosen in .net or is it all just hand coded?

Thanks for any helps and tips to get me started ;)

Nila
Logged

scott_r

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 306
Re:Visual Basic .net - Tree View
« Reply #1 on: February 02, 2004, 07:27:34 pm »

TreeView.Nodes.Add returns a TreeNode object which you can manipulate from there.

For example:

Code: [Select]
Dim i as Integer
Dim tv as new TreeView
Dim currentNode as TreeNode = tv.Nodes.Add("Root")
For i = 1 to 5
 currentNode = currentNode.Nodes.Add(i)
Next i

Will create a new TreeView object (which you can place and size wherever) and then add one root node called "Root" which has a sub-tree five levels deep.

As for the object events, There should be two drop-down comboboxes above the code view. The left one selects the object and the right one selects the event.

Scott
Logged

nila

  • Guest
Re:Visual Basic .net - Tree View
« Reply #2 on: February 03, 2004, 05:27:49 am »

Cheers Scott,

that got me going nicely ;)

Thanks!
Logged
Pages: [1]   Go Up