Click here to Skip to main content
15,902,905 members
Home / Discussions / C#
   

C#

 
AnswerRe: Selected TreeView Item Pin
Rob Graham25-Nov-06 10:47
Rob Graham25-Nov-06 10:47 
AnswerRe: Selected TreeView Item Pin
beatles169225-Nov-06 22:53
beatles169225-Nov-06 22:53 
QuestionSelected TreeView Item [modified] Pin
Alan Martinis25-Nov-06 9:22
Alan Martinis25-Nov-06 9:22 
AnswerRe: Selected TreeView Item Pin
Bassam Saoud25-Nov-06 22:12
Bassam Saoud25-Nov-06 22:12 
GeneralRe: Selected TreeView Item Pin
Alan Martinis26-Nov-06 12:48
Alan Martinis26-Nov-06 12:48 
GeneralRe: Selected TreeView Item Pin
Scott Dorman27-Nov-06 4:51
professionalScott Dorman27-Nov-06 4:51 
AnswerRe: Selected TreeView Item Pin
darkelv26-Nov-06 15:57
darkelv26-Nov-06 15:57 
QuestionAdding new items to TreeView Pin
Mark F.25-Nov-06 8:53
Mark F.25-Nov-06 8:53 
First of all, I just started learning C# and I'm using VS 2005 Express Ed.

I have a small form with a TreeView control in it. I want to pass a root folder to the following function and populate a TreeView control with directories. My problem is that I don't know how to access the parent nodes or child nodes to add the subdirectory under it's parent directory. The following code simply displays all the folders under the first node.
private void FindAllFolders(string sFolder)
{
    try
    {
        foreach (string dir in Directory.GetDirectories(sFolder))
        {
            string temp = dir.ToString().Substring(rootFolder.Length);
            treeView1.Nodes[0].Nodes.Add(new TreeNode(temp, 1, 2));
            FindAllFolders(dir);
        }
    }
    catch (Exception e)
    {
        MessageBox.Show(e.Message.ToString(), "Directory Search Exception Error",
            MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
}


Thanks,
Mark
AnswerRe: Adding new items to TreeView Pin
Not Active25-Nov-06 10:28
mentorNot Active25-Nov-06 10:28 
GeneralRe: Adding new items to TreeView Pin
Mark F.25-Nov-06 11:22
Mark F.25-Nov-06 11:22 
GeneralRe: Adding new items to TreeView Pin
Not Active25-Nov-06 14:11
mentorNot Active25-Nov-06 14:11 
QuestioncrystalReport Pin
aPerfectCircle25-Nov-06 8:18
aPerfectCircle25-Nov-06 8:18 
Questionbubble and quick method Pin
sapnju_fejinja25-Nov-06 7:33
sapnju_fejinja25-Nov-06 7:33 
QuestionRe: bubble and quick method Pin
CPallini25-Nov-06 8:50
mveCPallini25-Nov-06 8:50 
AnswerRe: bubble and quick method Pin
sapnju_fejinja25-Nov-06 9:47
sapnju_fejinja25-Nov-06 9:47 
GeneralRe: bubble and quick method Pin
Rob Graham25-Nov-06 10:38
Rob Graham25-Nov-06 10:38 
GeneralRe: bubble and quick method Pin
Paul Conrad25-Nov-06 11:28
professionalPaul Conrad25-Nov-06 11:28 
GeneralRe: bubble and quick method Pin
CPallini25-Nov-06 10:41
mveCPallini25-Nov-06 10:41 
QuestionPoint Of Sale Project Pin
Waskira25-Nov-06 7:06
Waskira25-Nov-06 7:06 
QuestionOut-of-memory Exception Pin
yonidebest25-Nov-06 5:57
yonidebest25-Nov-06 5:57 
AnswerRe: Out-of-memory Exception Pin
S. Senthil Kumar25-Nov-06 6:32
S. Senthil Kumar25-Nov-06 6:32 
QuestionRe: Out-of-memory Exception Pin
yonidebest25-Nov-06 9:07
yonidebest25-Nov-06 9:07 
AnswerRe: Out-of-memory Exception Pin
Argus225-Nov-06 12:52
Argus225-Nov-06 12:52 
GeneralRe: Out-of-memory Exception Pin
yonidebest26-Nov-06 10:43
yonidebest26-Nov-06 10:43 
AnswerRe: Out-of-memory Exception Pin
S. Senthil Kumar25-Nov-06 18:10
S. Senthil Kumar25-Nov-06 18:10 

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.