-
Junior Member
How to build simple Treeview programatically?
Hi Friends,
I need to add the 3 items under one root node and show in the form of tree view using programatically. so that please if any body knows please let me know.
Regards,
Pradeep
-
Junior Member
Re: How to build simple Treeview programatically?
Public static void updatetreeview(universal_database_manager form) { datatable dt; treenode tn1,tn2,tn3; string databasename; form.datatreeview.nodes.clear(); foreach (databaseinformation di in databaselist) { dt=di.databasetable; if (dt != null) //for a normal database server { tn1 = new treenode(di.connection.datasource + ":-" + di.connection.serverversion); tn1.imageindex=0; form.datatreeview.nodes.add(tn1); foreach(datarow dr1 in di.databasetable.rows) { databasename= dr1["database_name"].tostring(); tn2 = new treenode(databasename ); tn2.imageindex = 1; tn1.nodes.add(tn2); foreach(datarow dr2 in di.gettable(databasename).rows ) { if (dr2["table_catalog"].tostring() == "") { if (string.compare(dr2["table_schema"].tostring(), databasename) == 0) { tn3 = new treenode(dr2["table_name"].tostring()); tn3.imageindex = 2; tn2.nodes.add(tn3); } } else { tn3 = new treenode(dr2["table_schema"].tostring() + "." + dr2["table_name"].tostring()); tn3.imageindex = 2; tn2.nodes.add(tn3); } } } } else //for a normal desktop database { tn1 = new treenode(di.connection.datasource + ":-" + di.connection.serverversion); tn1.imageindex = 0; form.datatreeview.nodes.add(tn1); foreach (datarow dr in di.gettable().rows) { tn1.nodes.add(dr["table_name"].tostring()); tn1.imageindex = 1; } } } } }
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules