CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Writing Data

  1. #1
    Join Date
    Dec 2011
    Posts
    19

    Exclamation Writing Data

    Well Can Anybody help me write a vb.net code to make an xml having such data -

    <Rule count="1">
    <time filename="1" holder="abc" handler="xyz" gross="pqr"></time>
    </Rule>

    I'm a beginner at vb.net and felt it was quite easy than others. Got recommended about this site.........so please help

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Writing Data

    Might help if you wanted to learn how to use VB.Net...

    Also, if you search for VB.Net XML CODE, you'll find such things. I prefer LINQ to XML

    http://www.hookedonlinq.com/LinqToXM...eOVerview.ashx

    Had to change the C# into VB.Net (in RED)

    Code:
    Dim xml  as XElement = new XElement("contacts",
                        new XElement("contact", 
                            new XAttribute("contactId", "2"),
                            new XElement("firstName", "Barry"),
                            new XElement("lastName", "Gottshall")
                        ),
                        new XElement("contact", 
                            new XAttribute("contactId", "3"),
                            new XElement("firstName", "Armando"),
                            new XElement("lastName", "Valdes")
                        )
                    );
     
     
    Console.WriteLine(xml);

    <contacts>
    <contact contactId="2">
    <firstName>Barry</firstName>
    <lastName>Gottshall</lastName>
    </contact>
    <contact contactId="3">
    <firstName>Armando</firstName>
    <lastName>Valdes</lastName>
    </contact>
    </contacts>
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured