le comento el programa se ejecuta sin ningún problema solo que no arroja las características de los componentes del ordenador :
aquí le dejo el código:
private void MuestraInformacion1(String Key)
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from " + Key);
listView1.Items.Clear();
ListViewGroup lstvg;
try
{
foreach (ManagementObject objeto in searcher.Get())
{
try
{
lstvg = listView1.Groups.Add(objeto["Name"].ToString(), objeto["Name"].ToString());
}
catch
{
lstvg = listView1.Groups.Add(objeto["Name"].ToString(), objeto["Name"].ToString());
}
if (objeto.Properties.Count <= 0)
{
MessageBox.Show("La Información No Está Disponible", "No Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
foreach (PropertyData PropiedadObjeto in objeto.Properties)
{
ListViewItem listViewItem1 = new ListViewItem(lstvg);
listViewItem1.Text = PropiedadObjeto.Name;
if (PropiedadObjeto.Value != null && PropiedadObjeto.Value.ToString() != "")
{
listViewItem1.SubItems.Add(PropiedadObjeto.Value.ToString());
listView1.Items.Add(listViewItem1);
}
else
{
//informacion nula
}
}
}
}
catch (Exception exp)
{
MessageBox.Show("No se pueden obtener datos \n" + exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
// Por medio de un evento mano a llamar el método:
private void button1_Click(object sender, EventArgs e)
{
MuestraInformacion1("Win32_Processor");
}