Results 1 to 2 of 2

Thread: How to build simple Treeview programatically?

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Answers
    4

    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


  2. #2
    Junior Member
    Join Date
    Sep 2007
    Answers
    7

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact