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

C#

 
AnswerRe: DLL Decomplile Pin
Pete O'Hanlon27-Apr-10 22:36
mvePete O'Hanlon27-Apr-10 22:36 
AnswerRe: DLL Decomplile Pin
harold aptroot28-Apr-10 2:00
harold aptroot28-Apr-10 2:00 
QuestionReading & Modifying XML Data in C# Pin
GrgBalden27-Apr-10 6:53
GrgBalden27-Apr-10 6:53 
AnswerRe: Reading & Modifying XML Data in C# Pin
Dan Mos27-Apr-10 7:17
Dan Mos27-Apr-10 7:17 
GeneralRe: Reading & Modifying XML Data in C# Pin
GrgBalden27-Apr-10 23:33
GrgBalden27-Apr-10 23:33 
GeneralRe: Reading & Modifying XML Data in C# [modified] Pin
Dan Mos28-Apr-10 3:24
Dan Mos28-Apr-10 3:24 
GeneralRe: Reading & Modifying XML Data in C# Pin
GrgBalden28-Apr-10 4:43
GrgBalden28-Apr-10 4:43 
GeneralRe: Reading & Modifying XML Data in C# Pin
Dan Mos28-Apr-10 8:02
Dan Mos28-Apr-10 8:02 
here you go.

I created a dummy class that holds the Block name and the rec count:

C#
public class BlockCount
{
    private int count = 0;
    public int Count
    {
        get { return count; }
        set { count = value; }
    }

    private string block;
    public string Block
    {
        get { return block; }
        set { block = value; }
    }
}

private void button1_Click(object sender, EventArgs e)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load("Abs.xml");

        //get the requestNodes
        XmlNodeList requests = doc.GetElementsByTagName("Request");

        if (requests != null && requests.Count > 0)
        {
            blocks = new List<BlockCount>();
            //now get the blocks nodes
            foreach (XmlNode nd in requests)
            {
                foreach (XmlNode blck in nd.ChildNodes)
                {
                    //create a new instance of the class
                    BlockCount c = new BlockCount();
                    //set the name of the block
                    c.Block = blck.Name;
                    foreach (XmlNode rec in blck.ChildNodes)
                    {
                        c.Count++;
                    }
                    blocks.Add(c);
                }
            }
        }
        //this is just for testing the results witch are fine by the way
        dataGridView1.DataSource = blocks;
    }
}


modified on Wednesday, April 28, 2010 2:11 PM

GeneralRe: Reading & Modifying XML Data in C# Pin
GrgBalden28-Apr-10 10:44
GrgBalden28-Apr-10 10:44 
QuestionCheckbox on the ColumnHeader [modified] Pin
Natural_Demon27-Apr-10 4:55
Natural_Demon27-Apr-10 4:55 
AnswerRe: Checkbox on the ColumnHeader [modified] Pin
Natural_Demon27-Apr-10 5:39
Natural_Demon27-Apr-10 5:39 
AnswerRe: Checkbox on the ColumnHeader Pin
Natural_Demon27-Apr-10 9:12
Natural_Demon27-Apr-10 9:12 
QuestionHow Secure are MDF DB Files? Pin
Caniac21727-Apr-10 2:21
Caniac21727-Apr-10 2:21 
AnswerRe: How Secure are MDF DB Files? Pin
Michel Godfroid27-Apr-10 3:35
Michel Godfroid27-Apr-10 3:35 
GeneralRe: How Secure are MDF DB Files? Pin
Caniac21727-Apr-10 4:23
Caniac21727-Apr-10 4:23 
QuestionMessage Removed Pin
27-Apr-10 2:17
Emmet_Brown27-Apr-10 2:17 
AnswerRe: form design / update clash Pin
Rajesh Anuhya27-Apr-10 2:21
professionalRajesh Anuhya27-Apr-10 2:21 
GeneralRe: form design / update clash Pin
Emmet_Brown27-Apr-10 3:51
Emmet_Brown27-Apr-10 3:51 
GeneralRe: form design / update clash Pin
AspDotNetDev27-Apr-10 18:14
protectorAspDotNetDev27-Apr-10 18:14 
JokeRe: form design / update clash Pin
Calla27-Apr-10 20:01
Calla27-Apr-10 20:01 
QuestionCopyFile Pin
toto_201027-Apr-10 1:48
toto_201027-Apr-10 1:48 
AnswerRe: CopyFile Pin
Rajesh Anuhya27-Apr-10 1:51
professionalRajesh Anuhya27-Apr-10 1:51 
AnswerRe: CopyFile Pin
Rajesh Anuhya27-Apr-10 1:59
professionalRajesh Anuhya27-Apr-10 1:59 
AnswerRe: CopyFile Pin
harold aptroot27-Apr-10 5:02
harold aptroot27-Apr-10 5:02 
GeneralRe: CopyFile Pin
toto_201027-Apr-10 7:11
toto_201027-Apr-10 7:11 

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.