I started doing some applications in VB.Net in the past year and a half and despite all my research for an answer, nothing has worked fine enough for me, so here I am, asking my question.
I have an application which allows the user to save the following data in an XML file:
- Custom name for the saved data above (inputted in a text box called
txtName
) - Email (inputted in a text box called
txtEmail
) - Password (inputted in a text box called
txtPassword
)
The XML file (with the name: appData.xml
- see below for directory of executable file along with directory of xml file) looks like this template shown below. The xml file stores a total of 10 passwords and each password is being attributed an ID number. I have thought that I would need to attribute an ID number (from 01 to 10) to refer it in the code of my application. If there is an easier way to identify where to store the saved data, feel free to modify my xml file.
<?xml version="1.0" encoding="UTF-8"?>
<savedData>
<savedPassword id="01">
<name>Stored Name</name>
<email>storedname@email.com<email>
<password>storedPassword</password>
</savedPassword>
<savedPassword id="02">
<name>Stored Name</name>
<email>storedemail@email.com<email>
<password>storedPassword</password>
</savedPassword>
<-- Other data modules for ids 03 to 09 --!>
<savedPassword id="10">
<name />
<email />
<password />
</savedPassword>
</savedData>
The XML is located in the following folder: C:\VelocityDK Codes\Password Manager
and the application's executable is located in the following folder: [USERPROFILE]\Documents\VelocityDK Codes
("[USERPROFILE]
" being the partial path to my documents folder on my Hard Drive).
As I am quite new to XML handling in VB.Net (windows forms), I have no idea if the name of the form is needed to retrieve the data from the xml - but if it is, here it is: frmMain
.
Sadly, I do not have enough experience in storing data from external data files and pulling that data from a file located in a completely different directory than the application file withing the load of the executable files, so I do not actually have any code to provide... Therefore, what I want to do is the following: I need to retrieve the data from my XML file at each launch automatically.