Click here to Skip to main content
15,885,981 members
Home / Discussions / C#
   

C#

 
GeneralRe: getting same numbers when executing a random number generation method? Pin
Richard Deeming8-Feb-18 9:23
mveRichard Deeming8-Feb-18 9:23 
QuestionGridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Deden Suansyah7-Feb-18 21:41
Deden Suansyah7-Feb-18 21:41 
AnswerRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Deden Suansyah7-Feb-18 21:49
Deden Suansyah7-Feb-18 21:49 
AnswerRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Richard MacCutchan7-Feb-18 22:13
mveRichard MacCutchan7-Feb-18 22:13 
GeneralRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Deden Suansyah7-Feb-18 23:04
Deden Suansyah7-Feb-18 23:04 
GeneralRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL Pin
Richard MacCutchan7-Feb-18 23:13
mveRichard MacCutchan7-Feb-18 23:13 
AnswerRe: Gridview C# Windows Application - Function in each cell column can automatically write words PASS and FAIL PinPopular
Eddy Vluggen8-Feb-18 1:18
professionalEddy Vluggen8-Feb-18 1:18 
QuestionHow can I enumerate through OU's for nodes and add them to an existing treeview root node? Pin
turbosupramk37-Feb-18 10:35
turbosupramk37-Feb-18 10:35 
Hello,

I am populating the root nodes of the treenode1 via the formload() function, I guess you could say they are hard coded.

After that I want to select a root node (which will be a domain) and enumerate the OUs of that domain and then make the outputted (via the code below) sub nodes of the root node (domain) that is already listed.

The function below makes the output, root nodes under the formload() created root nodes instead of subnodes under the formload() created root nodes, how can I make them subnodes of the original formload() root nodes?

Sorry if this is written in a confusing manner, I've tried to reread it and make it less confusing amidst my own confusion.


private void searchForOus(string ouPath)
{

    DirectoryEntry ADentry = new DirectoryEntry(ouPath, @"domain\user", "password", AuthenticationTypes.Secure);

    DirectorySearcher Searcher = new DirectorySearcher(ADentry);
    Searcher.Filter = ("(objectClass=organizationalUnit)");
    foreach (DirectoryEntry entry in Searcher.SearchRoot.Children)
    {
        Console.WriteLine(entry.Path);


        if (entry.Path == "LDAP://OU=Core Member Servers,dc=XXX,dc=XXX,dc=XX,dc=XXX")

        {
            if (ShouldAddNode(entry.SchemaClassName))
            {
                treeView1.Nodes.Add(GetChildNode(entry));

            }
        }
    }

private TreeNode GetChildNode(DirectoryEntry entry)
{
    TreeNode node = new TreeNode(entry.Name.Substring(entry.Name.IndexOf('=') + 1));

    foreach (DirectoryEntry childEntry in entry.Children)
    {
        if (ShouldAddNode(childEntry.SchemaClassName))
        {
            node.Nodes.Add(GetChildNode(childEntry));

        }
    }




    return node;
}

private bool ShouldAddNode(string schemaClass)
{
    bool returnValue = false;

    if (schemaClass == "organizationalUnit")
    {
        returnValue = true;
    }

    return returnValue;
}

AnswerRe: How can I enumerate through OU's for nodes and add them to an existing treeview root node? Pin
BillWoodruff7-Feb-18 16:53
professionalBillWoodruff7-Feb-18 16:53 
Question(beginner question) help with code for a project Pin
Member 136645666-Feb-18 11:14
Member 136645666-Feb-18 11:14 
AnswerRe: (beginner question) help with code for a project Pin
Eddy Vluggen6-Feb-18 14:34
professionalEddy Vluggen6-Feb-18 14:34 
AnswerRe: (beginner question) help with code for a project Pin
Richard MacCutchan6-Feb-18 23:18
mveRichard MacCutchan6-Feb-18 23:18 
GeneralRe: (beginner question) help with code for a project Pin
Member 136645667-Feb-18 3:21
Member 136645667-Feb-18 3:21 
GeneralRe: (beginner question) help with code for a project Pin
Richard MacCutchan7-Feb-18 3:31
mveRichard MacCutchan7-Feb-18 3:31 
GeneralRe: (beginner question) help with code for a project Pin
Member 136645667-Feb-18 5:00
Member 136645667-Feb-18 5:00 
GeneralRe: (beginner question) help with code for a project Pin
Richard MacCutchan7-Feb-18 5:13
mveRichard MacCutchan7-Feb-18 5:13 
GeneralRe: (beginner question) help with code for a project Pin
Gerry Schmitz7-Feb-18 5:29
mveGerry Schmitz7-Feb-18 5:29 
QuestionDesign-Question: Using ReturnValue or Throwing Exception Pin
Frygreen6-Feb-18 11:06
Frygreen6-Feb-18 11:06 
AnswerRe: Design-Question: Using ReturnValue or Throwing Exception Pin
Richard Andrew x646-Feb-18 12:17
professionalRichard Andrew x646-Feb-18 12:17 
AnswerRe: Design-Question: Using ReturnValue or Throwing Exception Pin
Eddy Vluggen6-Feb-18 15:06
professionalEddy Vluggen6-Feb-18 15:06 
AnswerRe: Design-Question: Using ReturnValue or Throwing Exception Pin
OriginalGriff6-Feb-18 23:21
mveOriginalGriff6-Feb-18 23:21 
AnswerRe: Design-Question: Using ReturnValue or Throwing Exception Pin
#realJSOP7-Feb-18 3:56
mve#realJSOP7-Feb-18 3:56 
AnswerRe: Design-Question: Using ReturnValue or Throwing Exception Pin
Gerry Schmitz7-Feb-18 5:45
mveGerry Schmitz7-Feb-18 5:45 
AnswerRe: Design-Question: Using ReturnValue or Throwing Exception Pin
Frygreen7-Feb-18 14:11
Frygreen7-Feb-18 14:11 
QuestionNunit3: Debug of Testcases. => No breakpoints hit with console-runner Pin
Frygreen6-Feb-18 9:35
Frygreen6-Feb-18 9:35 

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.