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

C#

 
AnswerRe: open exe file Pin
Abhijit Jana11-Oct-09 3:50
professionalAbhijit Jana11-Oct-09 3:50 
QuestionGet IP from IPInterfaceProperties Pin
Johan Martensson11-Oct-09 0:33
Johan Martensson11-Oct-09 0:33 
AnswerRe: Get IP from IPInterfaceProperties Pin
dataminers11-Oct-09 1:58
dataminers11-Oct-09 1:58 
GeneralRe: Get IP from IPInterfaceProperties Pin
Johan Martensson11-Oct-09 4:07
Johan Martensson11-Oct-09 4:07 
Questionwant dll to change pitch of the sound in C#. Pin
bill khan10-Oct-09 22:51
bill khan10-Oct-09 22:51 
QuestionCustom UserControl and the Designer Pin
softwarejaeger10-Oct-09 22:33
softwarejaeger10-Oct-09 22:33 
AnswerRe: Custom UserControl and the Designer Pin
Henry Minute11-Oct-09 1:18
Henry Minute11-Oct-09 1:18 
QuestionUDP SOCKS5 Help [modified] Pin
murktinez10-Oct-09 21:58
murktinez10-Oct-09 21:58 
AnswerRe: UDP SOCKS5 Help Pin
murktinez11-Oct-09 7:40
murktinez11-Oct-09 7:40 
Questioninternet explorer on page event hook Pin
nchandra.org10-Oct-09 14:01
nchandra.org10-Oct-09 14:01 
QuestionRefresh PropertyGrid on control resize? Pin
xJorDyx10-Oct-09 12:12
xJorDyx10-Oct-09 12:12 
AnswerRe: Refresh PropertyGrid on control resize? Pin
Mycroft Holmes10-Oct-09 12:32
professionalMycroft Holmes10-Oct-09 12:32 
AnswerRe: Refresh PropertyGrid on control resize? Pin
Henry Minute10-Oct-09 12:34
Henry Minute10-Oct-09 12:34 
QuestionWebBrowser control steal focus on page load Pin
harold aptroot10-Oct-09 12:02
harold aptroot10-Oct-09 12:02 
AnswerRe: WebBrowser control steal focus on page load Pin
OriginalGriff10-Oct-09 22:26
mveOriginalGriff10-Oct-09 22:26 
GeneralRe: WebBrowser control steal focus on page load Pin
harold aptroot10-Oct-09 22:31
harold aptroot10-Oct-09 22:31 
GeneralRe: WebBrowser control steal focus on page load Pin
OriginalGriff10-Oct-09 22:53
mveOriginalGriff10-Oct-09 22:53 
GeneralRe: WebBrowser control steal focus on page load Pin
harold aptroot10-Oct-09 23:07
harold aptroot10-Oct-09 23:07 
GeneralRe: WebBrowser control steal focus on page load Pin
OriginalGriff10-Oct-09 23:27
mveOriginalGriff10-Oct-09 23:27 
GeneralRe: WebBrowser control steal focus on page load Pin
harold aptroot10-Oct-09 23:40
harold aptroot10-Oct-09 23:40 
GeneralRe: WebBrowser control steal focus on page load Pin
harold aptroot11-Oct-09 5:39
harold aptroot11-Oct-09 5:39 
QuestionList tree help! Pin
venomation10-Oct-09 9:56
venomation10-Oct-09 9:56 
I have started to make a basic generic list tree how ever when it comes to adding a parent that has more than one node I have realised that i need to some how dynamicly add loops to i can display the details from "n" number of nodes attached, of course this is a silly idea so i need some help on finding a more feasible solution, can any body help me?

This is my source :

class Program
   {
       static void Main(string[] args)
       {
           CsTree tree = new CsTree();
           tree.AddNode(new CsNode<CsBox>(new CsBox(1,2,4,8)));


           tree.NodeList[0].AddChild(new CsBox(100,200,400,800));
           tree.NodeList[0].AddChild(new CsBox(2, 3, 4, 5));
           tree.AddNode(new CsNode<CsBox>(new CsBox(1, 1, 1, 1)));
           tree.NodeList[0].NodeMembersList[0].AddChild(new CsBox(2, 2, 2, 2));



           tree.DisplayAllNodeData();

           //Want this to be added for the CsTree>DisplayAllNodeData() but how can i dertermine how many loops?
           tree.NodeList[0].NodeMembersList[0].NodeMembersList[0].NodeData.DisplayDetails();
           Console.ReadKey();

       }
   }


class CsNode<T>
   {
      public T NodeData;
       public Dictionary<int, CsNode<T>> NodeMembersList = new Dictionary<int, CsNode<T>>();
       public int NodeMemberCount = 0;

       public CsNode(T nodeData)
       {
           NodeData = nodeData;

       }
       public void AddChild(T childData)
       {
           NodeMembersList.Add(NodeMemberCount, new CsNode<T>(childData));
           NodeMemberCount++;
       }

   }


class CsTree
   {
       public Dictionary<int, CsNode<CsBox>> NodeList = new Dictionary<int, CsNode<CsBox>>();
       public int TotalNodes = 0;


       public void AddNode(CsNode<CsBox> node)
       {
           NodeList.Add(TotalNodes, node);
           TotalNodes++;
       }

       //Only two loops so far as i realised i dont know how to dynamicly decide how many loops are needed
       public void DisplayAllNodeData()
       {
           for (int i = 0; i < TotalNodes;i++ )
           {

               NodeList[i].NodeData.DisplayDetails();
               for (int k = 0; k < NodeList[i].NodeMemberCount; k++)
               {
                   NodeList[i].NodeMembersList[k].NodeData.DisplayDetails();
               }
           }
       }

   }

class CsBox
    {
        public int X;
        public int Y;
        public int Width;
        public int Height;

        public CsBox(int x,int y,int width,int height)
        {
            X = x;
            Y = y;
            Width = width;
            Height = height;
        }

       public void DisplayDetails()
       {
           Console.WriteLine("X {0} Y {1} Width {2} Height {3}",X,Y,Width,Height);
       }
    }

So far i have managed to get it to display the details of The Base node, and its child nodes attached, i want it so i can display an unknown number of nodes attached to the child nodes if any, ie Base- Child - node - node ect instead of just Base - Child
D'Oh! | :doh:
AnswerRe: List tree help! Pin
Mycroft Holmes10-Oct-09 12:43
professionalMycroft Holmes10-Oct-09 12:43 
GeneralRe: List tree help! Pin
venomation10-Oct-09 12:59
venomation10-Oct-09 12:59 
AnswerRe: List tree help! Pin
Nicholas Butler11-Oct-09 1:14
sitebuilderNicholas Butler11-Oct-09 1:14 

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.