?
Solved

Save details to xml file?

Posted on 2009-06-29
6
Medium Priority
?
283 Views
Last Modified: 2012-05-07
Hi,

I have a form that allows a user to enter details about their location that I want to save to an xml file so they dont have to renter the details each time. This way I can set it to save multiple location details in future.

The problem I have is I dont know how to write the details to an xml file.

The form has textboxes for:

Location
Name
Telephone Number

I'm wanting to set a button to write these to an xml file so it would look like..

<site>
<location>New york</location>
<name>Paul</name>
<phone>00000000</phone>
</site>

Can anyone show me how I can go about this?

Thanks,
Paul.
0
Comment
Question by:m0tSiE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 11

Expert Comment

by:bmatumbura
ID: 24736757
This sample project may help:

http://www.freevbcode.com/ShowCode.Asp?ID=6322

0
 

Author Comment

by:m0tSiE
ID: 24737774
I tried downlaoding the source files but it wasn't compatible with vb.net.
0
 
LVL 13

Accepted Solution

by:
game-master earned 2000 total points
ID: 24741383


good morning!
try sumthing like this...

sub WriteXml()

Try
            Dim xmlSetting As New Xml.XmlWriterSettings
            xmlSetting.Indent = True

            Dim writer As Xml.XmlWriter = Xml.XmlWriter.Create("Sample.xml", xmlSetting)
            With writer
                .WriteStartDocument()
                .WriteStartElement("Site")
                .WriteElementString("Location", location.text)
                .WriteElementString("Name", name.text)
                .WriteElementString("Phone", phonenumber.text)
                .WriteEndElement()
                .WriteEndDocument()
                .Flush()
            End With
            MessageBox.Show("Done")
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try


end sub


i hope i can give u idea...

game-master
0
 

Author Closing Comment

by:m0tSiE
ID: 31597937
Cheers! :D
0
 
LVL 13

Expert Comment

by:game-master
ID: 24966686


thank you for accepting my answer....

i just got my guru level.... :-)



Praise Be Unto God!

game-master
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question