Need to some help here. Trying to input an XML into a form in Visual Studio and have it display with the XML formatting in tact. I have gotten it to display as one long line but need the formatting to be there. I am using a label in the form to show the text, not sure if that is the best way or not but only way I could get it to work
This is in the Form1.cs
string FormatXML(string xml)
{
XDocument.Load("Employee Roster.xml");
XDocument doc = XDocument.Parse(xml);
return(this.label1.Text = doc.ToString());
}
I have also tried
string FormatXML(string xml)
{
XDocument.Load("Employee Roster.xml");
try
{
XDocument doc = XDocument.Parse(xml);
return(this.label1.Text = doc.ToString());
}
Catch
{
return xml
}
I know there are other threads on this but they dont seem to specify how to define what file you are asking the form to read(I.E. the Load method)