Click here to Skip to main content
14,971,215 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
IM GOING CRAZY !!!

here's is my situation i can write xml w/o anyproblem example


VB
dim xmlwrt as xmlwriter = xmlwriter.create("C:\sample.xml", settings)

with xmlwrt
.writestartdocument()
.writestartelement("employee")

'Employee Data
.WriteStartElement("FirstName")
.WriteString(nametxt.text.tostring())
.WriteEndElement


same for lastname and address and employer card

lets say the employercard is 123456

now i want to create a BUTTON the load whats on "C:\sample.xml" by what it contains


example:

Textbox1.text = "123456"
Button1 = acceptbutton


then brings all the information is on that "C:\sample.xml" back to the TextBoxes
FirstName
Lastname
employercard
in case the i have to save it i just have to change something and click the button save on that design again to save the XML with the new data



Any help will be great!!!
Posted
Updated 5-Aug-12 14:26pm
v2
Comments
[no name] 5-Aug-12 20:28pm
   
I see a lot of "I want"... You want does not make a question. If you want to do all this then go right ahead and do it. You have my permission.
jitforce2585 5-Aug-12 20:48pm
   
Thanks for your permission and you right i want does not make a question so i guess i dont have a question..
Christian Graus 5-Aug-12 20:30pm
   
He also emailed me...
jitforce2585 5-Aug-12 20:48pm
   
Like i said sorry to bother you and i didnt mean to email you all the time i just needed some help wont happens again man
Christian Graus 5-Aug-12 20:55pm
   
And to be clear, I am very happy to help, I just like to limit the free help I give people to what is public on these boards. Feel free to ask me questions if you get stuck after working through the links in my answer
jitforce2585 5-Aug-12 20:59pm
   
ok thanks im trying to get the source code beginning from there i will keep going i just need the start code

Here is how you could read an XML file:
VB
Dim name as string

Public Sub Load(ByVal p_XMLfilename As String)
       XMLFilename = p_XMLfilename

       Dim x As New System.Xml.XmlDocument
       x.Load(p_XMLfilename)

       Dim x_nodes As System.Xml.XmlNodeList = x.SelectNodes("employee")
       For Each node As System.Xml.XmlNode In x_nodes

           For Each node2 As System.Xml.XmlNode In node
               Select Case node2.Name
                   Case Is = "FirstName" : name = node2.InnerText

               End Select
           Next

       Next
   End Sub
   
What have you tried ? Do you know how to use LINQ to XML[^] or the XmlDocument[^] class to read and parse XML ? Do you know how to use the OpenFileDialog[^] class ?
   
Comments
Christian Graus 5-Aug-12 20:32pm
   
I'm sorry, I never answer emails because, well, then you'd have my email and feel free to email me questions all the time. Also, it would mean that no-one else could find the solutions on this forum. So, instead of emailing me the same question, look at my answer and read the documentation I've linked to. You emailed me that you're 'GOING CRAZY', but what you want is trivial, and I've linked you to the documentation for the objects you need. By all means, comment here if you have more questions, I am more than happy to help you if you apply yourself to the thing I've told you and get stuck again. But, this is all the answer I can give right now, unless I went and wrote all the code for you and if I did that, experience tells me you'd paste it without understanding it, and be asking similar questions here in no time.
jitforce2585 5-Aug-12 20:51pm
   
Thanks you and you are right about if the copy / paste but i just needed a clue and from there ill take it i dont need the entire code but let me try to get it from what you gave me ... thanks again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900