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

C#

 
Questionclear ComboBox content? Pin
george ivanov14-Jun-05 3:51
george ivanov14-Jun-05 3:51 
AnswerRe: clear ComboBox content? Pin
Roger Stewart14-Jun-05 3:55
professionalRoger Stewart14-Jun-05 3:55 
Generalpicturebox Pin
Member 204148114-Jun-05 0:22
Member 204148114-Jun-05 0:22 
Generaldatagrid select row Pin
xrado14-Jun-05 1:47
xrado14-Jun-05 1:47 
GeneralRe: datagrid select row Pin
Sendilkumar.M14-Jun-05 16:22
Sendilkumar.M14-Jun-05 16:22 
GeneralRe: datagrid select row Pin
xrado14-Jun-05 19:40
xrado14-Jun-05 19:40 
GeneralMemory and Collections Pin
horacyjr14-Jun-05 1:37
horacyjr14-Jun-05 1:37 
GeneralRe: Memory and Collections Pin
Christian Graus14-Jun-05 1:58
protectorChristian Graus14-Jun-05 1:58 
Why not a class for each, which carries an arraylist of it's children and one of it's parents ? Ideally, you could give each person an ID, and store the names in a single hashtable by ID, so you can look up names when you need them, but the classes just carry an array of numbers ( nice and efficient, each name is only stored once ).

Then you could have a single arraylist of person objects, each of which has it's own ID, and the ID's of it's relatives. Of course, I'm not sure how this would suit you in terms of your searching needs.

So

Person bob = new Person("Bob");
Person fred = new Person("Fred");
Person Bill = new Person("Bill");

Inside the person class:

ArrayList myChildren = new ArrayList();
static Hashtable Names = new Hashtable();
static int IDs = 0;

Inside the constructor:

this.ID = IDs++;
Person.Names[this.ID] = name;

Then a method to add a child:

public int AddChild(Person child)
{
myChildren.Add(child.ID);

return myChildren.Count;
}

You could either add grandchildren with a method, or implicitly ( have a GetGrandchildren method that works out who the children of my children are ).



Christian Graus - Microsoft MVP - C++
GeneralRe: Memory and Collections Pin
horacyjr14-Jun-05 3:07
horacyjr14-Jun-05 3:07 
GeneralRe: Memory and Collections Pin
leppie14-Jun-05 4:37
leppie14-Jun-05 4:37 
GeneralRe: Memory and Collections Pin
Judah Gabriel Himango14-Jun-05 8:26
sponsorJudah Gabriel Himango14-Jun-05 8:26 
Generaltransfer files from server to client Pin
pjay2314-Jun-05 1:34
pjay2314-Jun-05 1:34 
GeneralRe: transfer files from server to client Pin
Christian Graus14-Jun-05 1:37
protectorChristian Graus14-Jun-05 1:37 
Generaldelete unfected files Pin
Member 182653314-Jun-05 1:24
Member 182653314-Jun-05 1:24 
GeneralRe: delete unfected files Pin
Christian Graus14-Jun-05 1:31
protectorChristian Graus14-Jun-05 1:31 
GeneralRe: delete unfected files Pin
mav.northwind14-Jun-05 3:34
mav.northwind14-Jun-05 3:34 
GeneralDesktop Icons Pin
Sabry190514-Jun-05 0:51
Sabry190514-Jun-05 0:51 
Generalquery about retrieving data from varbinary types Pin
G_Zola14-Jun-05 0:10
G_Zola14-Jun-05 0:10 
GeneralGDI+ flicker when drawing to a panel Pin
JDUK13-Jun-05 20:18
JDUK13-Jun-05 20:18 
GeneralRe: GDI+ flicker when drawing to a panel Pin
JDUK13-Jun-05 20:59
JDUK13-Jun-05 20:59 
GeneralRe: GDI+ flicker when drawing to a panel Pin
Judah Gabriel Himango14-Jun-05 8:35
sponsorJudah Gabriel Himango14-Jun-05 8:35 
GeneralRe: GDI+ flicker when drawing to a panel Pin
JDUK14-Jun-05 12:40
JDUK14-Jun-05 12:40 
GeneralProperty with another name in the Designer Pin
Trambert13-Jun-05 22:47
Trambert13-Jun-05 22:47 
GeneralRe: Property with another name in the Designer Pin
MoustafaS14-Jun-05 0:35
MoustafaS14-Jun-05 0:35 
GeneralRe: Property with another name in the Designer Pin
Trambert15-Jun-05 2:08
Trambert15-Jun-05 2:08 

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.