how to show xml info in listview

  • Thread starter Thread starter Policy standard local admin account with Active Di
  • Start date Start date
P

Policy standard local admin account with Active Di

Guest
Hello

This is a continuation from a code that I have posted before. The last question was answered satisfactorily but I have a new dude.

In my code, I found a specific attribut and if I use the console.writeline command, I can show by console all the information (similar code using console) but if I use system.windows.form and I try try to show in a list view, the View is empty. How can I show the results in the listview?

- the listview name is SearchResults2

Please, follow the design below:

1442128.png

please, follow my code below

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;


private void button2_Click(object sender, EventArgs e)
{

XElement GetAttribut = XElement.Load(@"C:\mis documentos\c#\xml\SipServer.config");
IEnumerable<XElement> sipeliafile = GetAttribut.Elements();


var GetCodec = from codec in sipeliafile.Descendants("Codec")
where codec.Attribute("Enabled")?.Value == "True"
select codec;


foreach (XElement codec in GetCodec)
{
SearchResults2.Items.Add(codec.Value);
}




}
}
}




Regards,


Jose

Continue reading...
 
Back
Top