Click here to Skip to main content
15,917,176 members
Home / Discussions / C#
   

C#

 
GeneralRe: TreeView Recursion [modified] Pin
Muammar©10-Aug-09 7:45
Muammar©10-Aug-09 7:45 
General[Message Deleted] Pin
Muammar©11-Aug-09 3:13
Muammar©11-Aug-09 3:13 
GeneralRe: TreeView Recursion Pin
N a v a n e e t h11-Aug-09 4:23
N a v a n e e t h11-Aug-09 4:23 
GeneralRe: TreeView Recursion Pin
Muammar©12-Aug-09 3:36
Muammar©12-Aug-09 3:36 
GeneralRe: TreeView Recursion Pin
N a v a n e e t h12-Aug-09 7:17
N a v a n e e t h12-Aug-09 7:17 
GeneralRe: TreeView Recursion Pin
Muammar©12-Aug-09 7:37
Muammar©12-Aug-09 7:37 
GeneralRe: TreeView Recursion Pin
Muammar©12-Aug-09 10:41
Muammar©12-Aug-09 10:41 
AnswerSolved! Pin
Muammar©13-Aug-09 7:10
Muammar©13-Aug-09 7:10 
Hey there Nav,
Just came up with another way to do it and thought you should know...

private DataTable GenDT(string strSelect)
{
    if (con.State != ConnectionState.Open)
        con.Open();


    DataTable _dt = new DataTable();
    try
    {
        new OracleDataAdapter(strSelect, con).Fill(_dt);
    }
    catch (Exception) { }
    return _dt;
}

private void LoadChilds(string _Parent, TreeNode _Node)
{
    DataTable dt = GenDT("SELECT ID,PARENT,NAME FROM TT WHERE PARENT ="+_Parent+" ORDER BY ID");

    for (int x = 0; x < dt.Rows.Count;x++ )
    {
        _Node.Nodes.Add(dt.Rows[x]["ID"].ToString(), dt.Rows[x]["NAME"].ToString());
        LoadChilds(dt.Rows[x]["ID"].ToString(), _Node.Nodes[x]);
    }
}

private void pop_GTree()
{
    DataTable dt;
    //Loading root nodes
    dt = GenDT("SELECT ID,PARENT,NAME FROM TT WHERE PARENT = 0 ORDER BY ID");
    foreach (DataRow row in dt.Rows)
        treeView1.Nodes.Add(row["ID"].ToString(), row["NAME"].ToString());

    foreach(TreeNode tn in treeView1.Nodes)
    LoadChilds(tn.Name, tn);
}


Haven't put it through a heavy test but it looks fine.. Can you please take a look with your sharp logic and let me know if there's any potential run-time problem in the LoadChilds method?? Thank you Nav, and what about the co-article thing?? Are you in?? I suppose we write about this together and I manage the control part and loading the tree using this way, and you handle the linq part.. what do you say?? CPians love co-articlesSmile | :)


GeneralRe: Solved! Pin
N a v a n e e t h13-Aug-09 15:37
N a v a n e e t h13-Aug-09 15:37 
GeneralRe: Solved! Pin
Muammar©14-Aug-09 1:16
Muammar©14-Aug-09 1:16 
QuestionTrying to show progress using DownloadDataAsync Pin
steve_rm1-Aug-09 4:23
steve_rm1-Aug-09 4:23 
AnswerRe: Trying to show progress using DownloadDataAsync Pin
Abhijit Jana1-Aug-09 6:18
professionalAbhijit Jana1-Aug-09 6:18 
QuestionRe: Trying to show progress using DownloadDataAsync Pin
Steve1_rm1-Aug-09 6:44
Steve1_rm1-Aug-09 6:44 
AnswerRe: Trying to show progress using DownloadDataAsync Pin
Eddy Vluggen1-Aug-09 7:00
professionalEddy Vluggen1-Aug-09 7:00 
GeneralRe: Trying to show progress using DownloadDataAsync Pin
Steve1_rm1-Aug-09 7:33
Steve1_rm1-Aug-09 7:33 
GeneralRe: Trying to show progress using DownloadDataAsync Pin
Eddy Vluggen1-Aug-09 8:39
professionalEddy Vluggen1-Aug-09 8:39 
AnswerRe: Trying to show progress using DownloadDataAsync Pin
Luc Pattyn1-Aug-09 8:43
sitebuilderLuc Pattyn1-Aug-09 8:43 
AnswerRe: Trying to show progress using DownloadDataAsync Pin
Alan N1-Aug-09 13:57
Alan N1-Aug-09 13:57 
QuestionConnecting C# application to online MS Access database Pin
Alexander Szmidt1-Aug-09 3:43
Alexander Szmidt1-Aug-09 3:43 
AnswerRe: Connecting C# application to online MS Access database Pin
Dave Kreskowiak1-Aug-09 5:10
mveDave Kreskowiak1-Aug-09 5:10 
AnswerRe: Connecting C# application to online MS Access database Pin
nelsonpaixao1-Aug-09 5:12
nelsonpaixao1-Aug-09 5:12 
AnswerRe: Connecting C# application to online MS Access database Pin
Eddy Vluggen1-Aug-09 7:06
professionalEddy Vluggen1-Aug-09 7:06 
QuestionCan I write programs in C # to Micro Controllers Pin
Nasir131-Aug-09 2:33
Nasir131-Aug-09 2:33 
AnswerRe: Can I write programs in C # to Micro Controllers Pin
DaveyM691-Aug-09 2:47
professionalDaveyM691-Aug-09 2:47 
RantRe: Can I write programs in C # to Micro Controllers Pin
Nasir131-Aug-09 3:58
Nasir131-Aug-09 3:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.