Dans les composant de type Performance Counter, il y a des attributs
CategoryName & CounterName dans l'ide de Visual Studio, il y a la liste
dont on sélectionne la valeur dans la fenetre des propriétés.
Comment récupérer cette liste via du code ... histoire de pouvoir modifier
en temps réel notre joli compteur.
private void cbCategoryName_SelectedIndexChanged(object sender, System.EventArgs e) { try { PerformanceCounterCategory pcInfo = new PerformanceCounterCategory(this.cbCategoryName.Text); PerformanceCounter[] arrCntrs = pcInfo.GetCounters(); for (int i=0; i < arrCntrs.Length;i++) this.cbCounterName.Items.Add(arrCntrs[i].CounterName); } catch(Exception Ex){ MessageBox.Show(Ex.Message);} }
private void cbCounterName_SelectedIndexChanged(object sender, System.EventArgs e) { PerformanceCounterCategory pcCat = new PerformanceCounterCategory(this.cbCategoryName.Text); string[] arrInstanceNames = pcCat.GetInstanceNames(); if (arrInstanceNames.GetLength(0) > 1) { for (int i=0; i < arrInstanceNames.Length;i++) this.cbInstanceName.Items.Add(arrInstanceNames[i]); } }
en vous remerciant bonsoir !
"leo" a écrit dans le message de news:40e2b200$0$10621$
Bonjour,
Dans les composant de type Performance Counter, il y a des attributs CategoryName & CounterName dans l'ide de Visual Studio, il y a la liste dont on sélectionne la valeur dans la fenetre des propriétés.
Comment récupérer cette liste via du code ... histoire de pouvoir modifier en temps réel notre joli compteur.
merci a vous bonne semaine !
bon c t facile excusez moi pour le dérangement !
je poste, ca pourra servir a d'autres !
private void frmMain_Load(object sender, System.EventArgs e)
{
try
{
PerformanceCounterCategory[] arrCategories PerformanceCounterCategory.GetCategories();
for (int i=0; i < arrCategories.Length;i++)
this.cbCategoryName.Items.Add(arrCategories[i].CategoryName);
private void cbCategoryName_SelectedIndexChanged(object sender,
System.EventArgs e)
{
try
{
PerformanceCounterCategory pcInfo = new
PerformanceCounterCategory(this.cbCategoryName.Text);
PerformanceCounter[] arrCntrs = pcInfo.GetCounters();
for (int i=0; i < arrCntrs.Length;i++)
this.cbCounterName.Items.Add(arrCntrs[i].CounterName);
}
catch(Exception Ex){ MessageBox.Show(Ex.Message);}
}
private void cbCounterName_SelectedIndexChanged(object sender,
System.EventArgs e)
{
PerformanceCounterCategory pcCat = new
PerformanceCounterCategory(this.cbCategoryName.Text);
string[] arrInstanceNames = pcCat.GetInstanceNames();
if (arrInstanceNames.GetLength(0) > 1)
{
for (int i=0; i < arrInstanceNames.Length;i++)
this.cbInstanceName.Items.Add(arrInstanceNames[i]);
}
}
en vous remerciant bonsoir !
"leo" <kbumbaz@nospam-yahoo.fr> a écrit dans le message de
news:40e2b200$0$10621$626a14ce@news.free.fr...
Bonjour,
Dans les composant de type Performance Counter, il y a des attributs
CategoryName & CounterName dans l'ide de Visual Studio, il y a la liste
dont on sélectionne la valeur dans la fenetre des propriétés.
Comment récupérer cette liste via du code ... histoire de pouvoir modifier
en temps réel notre joli compteur.
private void cbCategoryName_SelectedIndexChanged(object sender, System.EventArgs e) { try { PerformanceCounterCategory pcInfo = new PerformanceCounterCategory(this.cbCategoryName.Text); PerformanceCounter[] arrCntrs = pcInfo.GetCounters(); for (int i=0; i < arrCntrs.Length;i++) this.cbCounterName.Items.Add(arrCntrs[i].CounterName); } catch(Exception Ex){ MessageBox.Show(Ex.Message);} }
private void cbCounterName_SelectedIndexChanged(object sender, System.EventArgs e) { PerformanceCounterCategory pcCat = new PerformanceCounterCategory(this.cbCategoryName.Text); string[] arrInstanceNames = pcCat.GetInstanceNames(); if (arrInstanceNames.GetLength(0) > 1) { for (int i=0; i < arrInstanceNames.Length;i++) this.cbInstanceName.Items.Add(arrInstanceNames[i]); } }
en vous remerciant bonsoir !
"leo" a écrit dans le message de news:40e2b200$0$10621$
Bonjour,
Dans les composant de type Performance Counter, il y a des attributs CategoryName & CounterName dans l'ide de Visual Studio, il y a la liste dont on sélectionne la valeur dans la fenetre des propriétés.
Comment récupérer cette liste via du code ... histoire de pouvoir modifier en temps réel notre joli compteur.