DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   C# (http://www.daniweb.com/forums/forum61.html)
-   -   read xml file and display to many text box (http://www.daniweb.com/forums/thread101154.html)

yemen2007 Dec 14th, 2007 4:04 pm
read xml file and display to many text box
 
hi

Dear Friend

i an the new member. i have problem in the xml file. my idea for project write to xml file and read the xml file and display to many the textBox. could you help me.i want display each value to sprat textBox..i want only for the read

Jugortha Dec 14th, 2007 5:44 pm
Re: read xml file and display to many text box
 
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);

yemen2007 Dec 15th, 2007 12:24 pm
Re: read xml file and display to many text box
 
HI

want say thanks cause you reply. The I done the part for write xml bout the problem is I want read the xml file and display inn the many text box. I want show me or explain for me how I can display the data inside xml file to the text box.

yemen2007 Dec 17th, 2007 2:44 pm
Re: read xml file and display to many text box
 
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());
}
}
}


All times are GMT -4. The time now is 3:49 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC