In this article i would like to explore a How To Read data From XML File Using Windows Forms Application Using C#.Net.
For this We need to Follow the following Steps
1.Take New Windows Forms Application
2.Design a Form as follows
3.Add The XML File
4.Write the XML File
5.Now Implement the logic as follows
1.Take New Windows Forms Application
2.Design a Form as follows
3.Add The XML File
4.Write the XML File
5.Now Implement the logic as follows
For this We need to Follow the following Steps
1.Take New Windows Forms Application
2.Design a Form as follows
3.Add The XML File
4.Write the XML File
5.Now Implement the logic as follows
1.Take New Windows Forms Application
2.Design a Form as follows
Reading XML File |
3.Add The XML File
Reading XML File |
Reading XML File |
4.Write the XML File
<?xml version="1.0" encoding="utf-8" ?>
<EmployeeDetails>
<Employee>
<Eid>PITS001</Eid>
<EName>Prudhvi</EName>
<Qualification>B.Tech</Qualification>
<CNo>123456789</CNo>
</Employee>
<Employee>
<Eid>PITS002</Eid>
<EName>Prasad</EName>
<Qualification>B.Tech</Qualification>
<CNo>987564133</CNo>
</Employee>
<Employee>
<Eid>PITS003</Eid>
<EName>Praveen</EName>
<Qualification>B.Tech</Qualification>
<CNo>5897456123</CNo>
</Employee>
</EmployeeDetails>
using System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
namespace XML
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void btnBrowse_Click(object
sender, EventArgs e)
{
openFileDialog1.Filter = "XML Files|*.Xml|All Files|*.*";
openFileDialog1.ShowDialog();
txtFileName.Text =
openFileDialog1.FileName;
}
private
void btnRead_Click(object
sender, EventArgs e)
{
DataSet
ds = new DataSet();
ds.ReadXml(txtFileName.Text);
dataGridView1.DataSource =
ds.Tables[0];
}
}
}
6.output
Reading XML File |
No comments :
Post a Comment