Saturday, December 10, 2011

Read Write XML Files

A pplications are complicated. Even the simplest software invariably contains numerous settings that have to store some sort of value in order to function at even a basic level. Database-driven applications usually have the luxury of storing the lion's share of their configuration information in a database of some sort, but there are always settings and options whose values can't be stored there such as the location of the database itself. 
No matter whatever the reason; here is a simple method to write into or read from xml file locally stored. It is advised to store desired xml file in the project bin folder other wise you will need to write full xml file path.


Create XML File:


Click here if you Don't know how to create a xml file. Name your new XML file as "User_Loged" Copy paste following codes save it in the project folder.



<?xml version="1.0" encoding="utf-8"?>
<Main>
  <User_Loged>
    <User_ID>1</User_ID>
    <User_Name>test</User_Name>
    <Terminal_ID>1</Terminal_ID>
    <Terminal_GUID>
    </Terminal_GUID>
    <Session_ID>86</Session_ID>
    <Time_Loged_In>
    </Time_Loged_In>
    <Session_GUID>
    </Session_GUID>
    <User_GUID>
    </User_GUID>
  </User_Loged>
</Main>


Create New Form:
Create new form copy and paste following codes in form designer






No comments:

Post a Comment