0

We are created a application using VB.So,Whenever i click the project exe file i want to create a xml file and store some config.details for my application for further needs.

Now i created that xml file in my local drive(d:\appConfig\config.xml).But we have to handover only our project exe to client.So,Client may have the D drive or not.So, How do i create the config xml file in common to all client machine.

This is my code:

Dim doc As XmlDocument = New XmlDocument
doc.Load("D:\appConfig\trial.xml")
Dim newElem As XmlElement
      newElem = doc.CreateNode(XmlNodeType.Element, "file", "testing")
      newElem.SetAttribute("filename", filenameenc)
      newElem.SetAttribute("expdate", g)
Dim root As XmlElement = doc.DocumentElement
    root.AppendChild(newElem)
doc.Save("D:\appConfig\trial.xml")

Is there any way to create the config xml?

Please guide me to get out of this issue?

Saravanan
  • 11,372
  • 43
  • 143
  • 213
  • First, tag properly your question. VB.Net and VBA are quite differents. Secondly, show the code you wrote to write the configuration file. Only then we may help you to correct your code. – Steve B Sep 13 '12 at 09:18
  • 2
    Do you want help writing to the XML, deciding where to put it, or what? For help deciding where to put it [see this answer](http://stackoverflow.com/questions/3054802/commonappdata-in-vb6/3073836#3073836) and [this article](http://visualstudiomagazine.com/articles/2009/01/19/lemme-tell-ya-where-to-stick-it.aspx) explains the various standard directories for storing app settings in Windows. For reading XML try [this question](http://stackoverflow.com/questions/3870485/reading-xml-files-in-vb6) – MarkJ Sep 13 '12 at 09:22
  • ... For writing XML try [SAX](http://msdn.microsoft.com/en-us/library/ms994312.aspx) or [MSXML](http://msdn.microsoft.com/en-us/library/aa468547.aspx) – MarkJ Sep 13 '12 at 09:26
  • I want help regarding where to put the file? where everyone can access from different machine... – Saravanan Sep 13 '12 at 09:28
  • 1
    Then see the "[this answer](http://stackoverflow.com/questions/3054802/commonappdata-in-vb6/3073836#3073836)" link that MarkJ gave you. – Deanna Sep 13 '12 at 14:21
  • have you considered just using .ini files? windows has all hte api's needed to make this work with your own custom .ini files, of course, if it needs to be deeply nested (yoru xml tree that is) then .ini is not a good idea. – Erx_VB.NExT.Coder Sep 15 '12 at 09:18

0 Answers0