开发者

TreeView, Access DB & Windows Form (C#)

开发者 https://www.devze.com 2022-12-19 23:54 出处:网络
hello friends I am in trouble, i have a school project in which I have to use tree view control to display fullname from DB in the following form.

hello friends I am in trouble, i have a school project in which I have to use tree view control to display fullname from DB in the following form.

suppose A is super memebr & under A there are others, and under other there could be other memeber and so on. its like chain system which will show referred member in hierarchical view.

Tha开发者_运维百科nk You


I would first create a class to represent a node in the tree: "Node".

That class should have as properties: 1. a List of child nodes 2. a string for full name

Then create instances of the Node class, drawing the data from your database.

Now you will have an in-memory representation of your data.

Now write a recursive function that takes an instance of Node class and returns an instance of TreeNode for use in the TreeView control. The function should recurse through all the child nodes of each Node instance.

Run that function on the root Node and you should have your TreeNode.

0

精彩评论

暂无评论...
验证码 换一张
取 消