473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

More Informations in a TreeView

Hello, the following code selects recursively the Outlook folders and
shows these in a Treeview. Everything works nice. I have the following
problem:

I would like have a TreeNode a text and two more values assigned to
this TreeNode e.g. an UserID and a Text.

These two information should not be visible. But if a user selects the
TreeNode i would like to read the information of the selected
TreeNode.

How can I build that in the code below??? I read about Inheritance but
i dont know how to implement those thing in my code below. For your
assistance I would be very grateful.
Private Sub Button3_Click
' Dim Application As Outlook.Application
Dim root As TreeNode
TreeView1.Nodes.Clear()
root = TreeView1.Nodes.Add("Outlook Root")
AddChildren(root, oNS.Folders)
End Sub

Private Sub AddChildren(ByVal root As TreeNode, ByVal list As
Outlook.Folders)
Dim flr As Outlook.MAPIFolder
Dim newRoot As TreeNode
For Each flr In list
newRoot = root.Nodes.Add(flr.Name)
AddChildren(newRoot, flr.Folders)
Next flr
End Sub
thanks
yavuz bogazci
Nov 20 '05 #1
6 2952
"Yavuz Bogazci" <ya***@bogazci.com> schrieb
Hello, the following code selects recursively the Outlook folders
and shows these in a Treeview. Everything works nice. I have the
following problem:

I would like have a TreeNode a text and two more values assigned
to this TreeNode e.g. an UserID and a Text.

These two information should not be visible. But if a user selects
the TreeNode i would like to read the information of the selected
TreeNode.

How can I build that in the code below??? I read about Inheritance
but i dont know how to implement those thing in my code below. For
your assistance I would be very grateful.
[...]


Derive your own node class from the Treenode class. In it's constructor pass
all the additional information you want to store with the node. For each
node, create a new instance of your own class.

public Class MyTreeNode
inherits TreeNode

public readonly Folder as Outlook.MAPIFolder

public sub new(Folder as Outlook.MAPIFolder)
mybase.new(folder.name)
me.folder=folder
end sub
end clss
Private Sub AddChildren(ByVal root As TreeNode, ByVal list As
Outlook.Folders)

Dim flr As Outlook.MAPIFolder
Dim newRoot As MyTreeNode

For Each flr In list
newRoot = New MyTreeNode(flr)
AddChildren(newRoot, flr.Folders)
Next flr

End Sub

--
Armin

Nov 20 '05 #2
Hello,

"Yavuz Bogazci" <ya***@bogazci.com> schrieb:
Hello, the following code selects recursively the Outlook folders and
shows these in a Treeview. Everything works nice. I have the following
problem:


Didn't that help?!

http://groups.google.de/groups?selm=...TNGP12.phx.gbl

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #3
Hi,

thank you! But there is only one Problem: I can't see the nodes! there
is no error and when i let show the name of the folders in the class
with messagebox it shows me all foldernames. but they aren't visible
in the treeview. there is no node created.

thanks
yavuz

ya***@bogazci.com (Yavuz Bogazci) wrote in message news:<a8**************************@posting.google. com>...
Hello, the following code selects recursively the Outlook folders and
shows these in a Treeview. Everything works nice. I have the following
problem:

I would like have a TreeNode a text and two more values assigned to
this TreeNode e.g. an UserID and a Text.

These two information should not be visible. But if a user selects the
TreeNode i would like to read the information of the selected
TreeNode.

How can I build that in the code below??? I read about Inheritance but
i dont know how to implement those thing in my code below. For your
assistance I would be very grateful.
Private Sub Button3_Click
' Dim Application As Outlook.Application
Dim root As TreeNode
TreeView1.Nodes.Clear()
root = TreeView1.Nodes.Add("Outlook Root")
AddChildren(root, oNS.Folders)
End Sub

Private Sub AddChildren(ByVal root As TreeNode, ByVal list As
Outlook.Folders)
Dim flr As Outlook.MAPIFolder
Dim newRoot As TreeNode
For Each flr In list
newRoot = root.Nodes.Add(flr.Name)
AddChildren(newRoot, flr.Folders)
Next flr
End Sub
thanks
yavuz bogazci

Nov 20 '05 #4
Hi,

thank you! But there is only one Problem: I can't see the
nodes! there
is no error and when i let show the name of the folders
in the class
with messagebox it shows me all foldernames. but they
aren't visible
in the treeview. there is no node created.

thanks
yavuz
-----Original Message-----
"Yavuz Bogazci" <ya***@bogazci.com> schrieb
Hello, the following code selects recursively the Outlook folders and shows these in a Treeview. Everything works nice. I have the following problem:

I would like have a TreeNode a text and two more values assigned to this TreeNode e.g. an UserID and a Text.

These two information should not be visible. But if a user selects the TreeNode i would like to read the information of the selected TreeNode.

How can I build that in the code below??? I read about Inheritance but i dont know how to implement those thing in my code below. For your assistance I would be very grateful.
[...]
Derive your own node class from the Treenode class. In

it's constructor passall the additional information you want to store with the node. For eachnode, create a new instance of your own class.

public Class MyTreeNode
inherits TreeNode

public readonly Folder as Outlook.MAPIFolder

public sub new(Folder as Outlook.MAPIFolder)
mybase.new(folder.name)
me.folder=folder
end sub
end clss
Private Sub AddChildren(ByVal root As TreeNode, ByVal list AsOutlook.Folders)

Dim flr As Outlook.MAPIFolder
Dim newRoot As MyTreeNode

For Each flr In list
newRoot = New MyTreeNode(flr)
AddChildren(newRoot, flr.Folders)
Next flr

End Sub

--
Armin

.

Nov 20 '05 #5
Ok it works!!!!!!

But how can i get now the object out of the node???????

thanks
yavuz bogazci

-----Original Message-----
"Yavuz Bogazci" <ya***@bogazci.com> schrieb
Hello, the following code selects recursively the Outlook folders and shows these in a Treeview. Everything works nice. I have the following problem:

I would like have a TreeNode a text and two more values assigned to this TreeNode e.g. an UserID and a Text.

These two information should not be visible. But if a user selects the TreeNode i would like to read the information of the selected TreeNode.

How can I build that in the code below??? I read about Inheritance but i dont know how to implement those thing in my code below. For your assistance I would be very grateful.
[...]
Derive your own node class from the Treenode class. In

it's constructor passall the additional information you want to store with the node. For eachnode, create a new instance of your own class.

public Class MyTreeNode
inherits TreeNode

public readonly Folder as Outlook.MAPIFolder

public sub new(Folder as Outlook.MAPIFolder)
mybase.new(folder.name)
me.folder=folder
end sub
end clss
Private Sub AddChildren(ByVal root As TreeNode, ByVal list AsOutlook.Folders)

Dim flr As Outlook.MAPIFolder
Dim newRoot As MyTreeNode

For Each flr In list
newRoot = New MyTreeNode(flr)
AddChildren(newRoot, flr.Folders)
Next flr

End Sub

--
Armin

.

Nov 20 '05 #6
"Yavuz Bogazci" <ya***@bogazci.com> schrieb
Ok it works!!!!!!

But how can i get now the object out of the node???????


For example, in the AfterSelect event:

dim MyNode as MyTreeNode
mynode = directcast(e.node, MyTreenode)

msgbox mynode.folder.name

--
Armin

Nov 20 '05 #7

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

Similar topics

0
by: Hermione | last post by:
Hi I want to work for a new application for the Pocket PC. I'd like to know about the following points: 1- Can I create an Access Database and transfert it to the pocket PC and access it ...
3
by: bredal Jensen | last post by:
I'm currently downloading the Microsoft "Visual web developer 2005 Express" and i have a few questions in case someone could have insider informations about this. I have just attended a seminar...
4
by: Yavuz Bogazci | last post by:
Hi, i have created a treeview and this works nice. I have now a problem: I want to store 2 more Information to each Treeview Node like UserID and CompanyID. How can i do that? Thanks Yavuz...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
14
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
1
by: kvicky | last post by:
I am trying to load child nodes to a TreeNode in a TreeView in a ASP.net web application. The Treeview with parent nodes are loaded on a Page_load while doing if( ! ISPostback ) and then in the...
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
0
by: metricspaces | last post by:
Hi, I'm using VB6 and the TreeView from "Microsoft Windows Common Controls.". Due to the bug http://support.microsoft.com/kb/182231 it is not possible to add more than 32767 nodes to the tree. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.