Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: List tree help! Pin
venomation11-Oct-09 3:13
venomation11-Oct-09 3:13 
QuestionPageSetupDialog doesn't autoselect "US Index Card 5x8" in Page Size dropdown list Pin
Mzungu Mark10-Oct-09 9:16
Mzungu Mark10-Oct-09 9:16 
QuestionDebugging a getter Pin
Hans Ruck10-Oct-09 9:03
Hans Ruck10-Oct-09 9:03 
AnswerRe: Debugging a getter Pin
Luc Pattyn10-Oct-09 11:04
sitebuilderLuc Pattyn10-Oct-09 11:04 
GeneralRe: Debugging a getter Pin
stancrm10-Oct-09 11:53
stancrm10-Oct-09 11:53 
GeneralRe: Debugging a getter Pin
Luc Pattyn10-Oct-09 12:50
sitebuilderLuc Pattyn10-Oct-09 12:50 
Questionbest way for a client/server program Pin
teknolog12310-Oct-09 8:51
teknolog12310-Oct-09 8:51 
AnswerRe: best way for a client/server program Pin
Md. Marufuzzaman10-Oct-09 8:58
professionalMd. Marufuzzaman10-Oct-09 8:58 
GeneralRe: best way for a client/server program Pin
teknolog12310-Oct-09 9:09
teknolog12310-Oct-09 9:09 
GeneralRe: best way for a client/server program Pin
Md. Marufuzzaman10-Oct-09 9:34
professionalMd. Marufuzzaman10-Oct-09 9:34 
GeneralRe: best way for a client/server program [modified] Pin
teknolog12310-Oct-09 9:49
teknolog12310-Oct-09 9:49 
GeneralRe: best way for a client/server program Pin
Xmen Real 10-Oct-09 20:31
professional Xmen Real 10-Oct-09 20:31 
AnswerRe: best way for a client/server program Pin
harold aptroot10-Oct-09 9:16
harold aptroot10-Oct-09 9:16 
GeneralRe: best way for a client/server program Pin
Md. Marufuzzaman10-Oct-09 9:21
professionalMd. Marufuzzaman10-Oct-09 9:21 

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.