•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 361,584 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,031 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser:
Views: 3034 | Replies: 3
![]() |
•
•
Join Date: Oct 2007
Posts: 92
Reputation:
Rep Power: 1
Solved Threads: 8
Your question is not very determined
If you want to write/read data from an xml file
add this namespace using System.Data to your project then create a new DataSet
DataSet myDataSet = new DataSet();
then:
to write data within an xml file use
string filePath = @"put your file path here";
myDataSet.WriteXml(filePath);
add this namespace using System.Data to your project then create a new DataSet
DataSet myDataSet = new DataSet();
then:
to read data from an xml file use
string filePath = @"put your file path here";
myDataSet.ReadXml(filePath);
If you want to write/read data from an xml file
add this namespace using System.Data to your project then create a new DataSet
DataSet myDataSet = new DataSet();
then:
to write data within an xml file use
string filePath = @"put your file path here";
myDataSet.WriteXml(filePath);
add this namespace using System.Data to your project then create a new DataSet
DataSet myDataSet = new DataSet();
then:
to read data from an xml file use
string filePath = @"put your file path here";
myDataSet.ReadXml(filePath);
•
•
Join Date: Dec 2007
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
hi
i done this code bout steel have problem can not diplay it in the text box
try
{
string sStartupPath = Application.StartupPath;
XmlTextReader obj =
new XmlTextReader(sStartupPath + @"selected.xml");
string sName = "";
while (obj.Read())
{
switch (obj.NodeType)
{
case XmlNodeType.Element:
sName = obj.Name;
break;
case XmlNodeType.Text:
switch (sName)
{
case "SiteName":
textBox1.Text = obj.GetAttribute("SiteName");
break;
case "WebmasterName":
textBox2.Text = obj.GetAttribute("WebmasterName");
break;
case "WebmasterEmail":
textBox3.Text = obj.GetAttribute("WebmasterEmail");
break;
case "NumberPages":
comboBox1.Text = obj.GetAttribute("NumberPages");
break;
case "FristTemplate":
radioButton1.Text = obj.GetAttribute("FristTemplate");
break;
case "SecondTemplate":
radioButton2.Text = obj.GetAttribute("SecondTemplate");
break;
}
break;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
i done this code bout steel have problem can not diplay it in the text box
try
{
string sStartupPath = Application.StartupPath;
XmlTextReader obj =
new XmlTextReader(sStartupPath + @"selected.xml");
string sName = "";
while (obj.Read())
{
switch (obj.NodeType)
{
case XmlNodeType.Element:
sName = obj.Name;
break;
case XmlNodeType.Text:
switch (sName)
{
case "SiteName":
textBox1.Text = obj.GetAttribute("SiteName");
break;
case "WebmasterName":
textBox2.Text = obj.GetAttribute("WebmasterName");
break;
case "WebmasterEmail":
textBox3.Text = obj.GetAttribute("WebmasterEmail");
break;
case "NumberPages":
comboBox1.Text = obj.GetAttribute("NumberPages");
break;
case "FristTemplate":
radioButton1.Text = obj.GetAttribute("FristTemplate");
break;
case "SecondTemplate":
radioButton2.Text = obj.GetAttribute("SecondTemplate");
break;
}
break;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C# Marketplace
- explorer.exe uses 99% CPU (Viruses, Spyware and other Nasties)
- trojans...now nothing opens and I get a paint can't open error (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: retreive data in textbox
- Next Thread: datagrid cell edit event


Linear Mode