C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » XML »

Writing in XML


Posted Date: 30 Jul 2009    Resource Type: Code Snippets    Category: XML
Author: DharmarajMember Level: Diamond    
Rating: 1 out of 5Points: 10 (Rs 4)



Writing in XML file



Create a xml file named contact with following fields (name,mobile) and save in the bin directory of your program.

Create a windows application and place a datagrid control and two textbox controls and a button named insert.

In the insert button write the following code

private void btnInsert_Click(object sender, EventArgs e)
{
dtRow = dsContact.Tables[0].NewRow();
dtRow["name"] = txtName.Text;
dtRow["mobile"] = txtMobile.Text;
txtName.Text = "";
txtMobile.Text = "";
dsContact.Tables["contact"].Rows.Add(dtRow);
dsContact.WriteXml(Application.StartupPath.ToString() + "/contact.xml");
ShowGrid();
lblstatus.Text = "Contact Successfully added";
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Writing in XML file  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Xml parser
Previous Resource: Add XML Comment
Return to Discussion Resource Index
Post New Resource
Category: XML


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use