Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
GeneralRe: codes Pin
ajay 201012-Feb-10 16:48
ajay 201012-Feb-10 16:48 
GeneralRe: codes Pin
Richard MacCutchan12-Feb-10 22:29
mveRichard MacCutchan12-Feb-10 22:29 
GeneralRe: codes Pin
ajay 201013-Feb-10 7:07
ajay 201013-Feb-10 7:07 
GeneralRe: codes Pin
Richard MacCutchan13-Feb-10 7:29
mveRichard MacCutchan13-Feb-10 7:29 
GeneralRe: codes Pin
ajay 201013-Feb-10 16:37
ajay 201013-Feb-10 16:37 
QuestionCalling WCF service manually Pin
Ramkithepower12-Feb-10 6:50
Ramkithepower12-Feb-10 6:50 
AnswerRe: Calling WCF service manually Pin
Not Active12-Feb-10 7:03
mentorNot Active12-Feb-10 7:03 
QuestionTreeNode sorting problem Pin
Zaegra12-Feb-10 3:52
Zaegra12-Feb-10 3:52 
I don't know if you know the GEDCOM file format (.ged, genealogy file standard[^]), but I'm trying to read one and I want to put it in a listview. The following code opens a gedcom file, and saves the data (per person) to a treeview.

StreamReader reader = new StreamReader(@"test.ged");
            string[] lines;
            string file_content = reader.ReadToEnd();
            lines = file_content.Split(Environment.NewLine.ToCharArray()[0]);
            this.Text = lines.Length.ToString();

            TreeNode currentperson = new TreeNode();
            foreach(string line in lines)
            {
                string newline = line.Replace("\n", "");
                newline = newline.Replace("\r", "");

                try
                {
                    if (newline[0].ToString() == "0")
                    {
                        //MessageBox.Show("newperson wotwot!");
                        newline = newline.Replace("@", "");
                        newline = newline.Replace("0", "");
                        newline = newline.Replace("INDI", "");
                        TreeNode newperson = new TreeNode(newline);
                        gedcomtree.Nodes.Add(newperson);
                        currentperson = newperson;
                    }
                    else
                    {
                        TreeNode currentnode = new TreeNode(newline);
                        currentperson.Nodes.Add(currentnode);
                    }
                }
                catch { }
            }


Now my question is: How can i sort the elements in a persons' node aswell?
Example:
1 BIRT
2 DATE 01 FEB 1750
2 PLAC EDINBURGH
3 NOTE Old place.
1 DEAT
2 DATE 02 FEB 1800

etc.

Should make:
- BIRT
-- DATE 01 FEB 1750
-- PLAC EDINGBURGH
--- NOTE Old place.
- DEAT
-- DATE 02 FEB 1800
(In a treeview)

Could someone help me out on this one? Im trying to get this to work for 3 days now, and i'm still stuck Sigh | :sigh:

Thanks in advance,
Zaegra
Motivation is the key to software development.

AnswerRe: TreeNode sorting problem Pin
Dan Mos12-Feb-10 8:23
Dan Mos12-Feb-10 8:23 
QuestionBackgroundWorker Pin
RugbyLeague12-Feb-10 3:29
RugbyLeague12-Feb-10 3:29 
AnswerRe: BackgroundWorker Pin
Luc Pattyn12-Feb-10 3:57
sitebuilderLuc Pattyn12-Feb-10 3:57 
GeneralRe: BackgroundWorker Pin
RugbyLeague12-Feb-10 4:01
RugbyLeague12-Feb-10 4:01 
GeneralRe: BackgroundWorker Pin
RugbyLeague12-Feb-10 4:31
RugbyLeague12-Feb-10 4:31 
AnswerRe: BackgroundWorker Pin
Luc Pattyn12-Feb-10 8:50
sitebuilderLuc Pattyn12-Feb-10 8:50 
GeneralRe: BackgroundWorker Pin
DaveyM6912-Feb-10 11:58
professionalDaveyM6912-Feb-10 11:58 
AnswerRe: BackgroundWorker Pin
Luc Pattyn12-Feb-10 12:28
sitebuilderLuc Pattyn12-Feb-10 12:28 
GeneralRe: BackgroundWorker Pin
DaveyM6912-Feb-10 12:38
professionalDaveyM6912-Feb-10 12:38 
GeneralRe: BackgroundWorker Pin
DaveyM6912-Feb-10 9:45
professionalDaveyM6912-Feb-10 9:45 
GeneralRe: BackgroundWorker Pin
DaveyM6912-Feb-10 10:19
professionalDaveyM6912-Feb-10 10:19 
GeneralRe: BackgroundWorker Pin
DaveyM6912-Feb-10 11:56
professionalDaveyM6912-Feb-10 11:56 
AnswerRe: BackgroundWorker Pin
Luc Pattyn12-Feb-10 12:26
sitebuilderLuc Pattyn12-Feb-10 12:26 
GeneralRe: BackgroundWorker Pin
DaveyM6912-Feb-10 12:37
professionalDaveyM6912-Feb-10 12:37 
GeneralRe: BackgroundWorker Pin
Luc Pattyn12-Feb-10 12:47
sitebuilderLuc Pattyn12-Feb-10 12:47 
QuestionDocumentation description about the method and its parameters. Pin
Blubbo12-Feb-10 3:29
Blubbo12-Feb-10 3:29 
AnswerRe: Documentation description about the method and its parameters. Pin
R. Giskard Reventlov12-Feb-10 3:33
R. Giskard Reventlov12-Feb-10 3:33 

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.