title: PerformanceCounter RawValue is not changed\modified
body: <p>I am trying to modify a PerformanceCounter I have created in C#.
   But it doesn't seem to be that it is being changed. This counter needs actualy to be a flag : 0 or 1.</p>
  
  <p>I took the following code from the net. It created the collectors category along with the counters well. But the RawValue always shows 0!</p>
  
  <p>I am working on Win7/64.</p>
  
  <p>Can you advise please?</p>
  
  <pre><code>    using System;
  using System.Diagnostics;
  using System.Runtime.InteropServices;
  
  namespace PerformanceCounterSample
  {
      /// &lt;summary&gt;
      /// Entry class for the sample
      /// &lt;/summary&gt;
      class PerformanceCounterSampleStarter
      {
          /// &lt;summary&gt;
          /// Imports the &lt;code&gt;QueryPerformanceFrequency&lt;/code&gt; me  thod into the class. The method is used to measure the current
          /// tickcount of the system.
          /// &lt;/summary&gt;
          /// &lt;param name="ticks"&gt;current tick count&lt;/param&gt;
          [DllImport("Kernel32.dll")]
          public static extern void QueryPerformanceCounter(ref long ticks);
  
          /// &lt;summary&gt;
          /// Main thread
          /// &lt;/summary&gt;
          [STAThread]
          static void Main(string[] args)
          {
              PerformanceCounterSample test = new PerformanceCounterSample();
              Random rand = new Random();
              long startTime = 0;
              long endTime = 0;
  
              for (int i=0; i&lt;1000; i++)
              {
                  // measure starting time
                  QueryPerformanceCounter(ref startTime);
  
                  System.Threading.Thread.Sleep(rand.Next(500));
  
                  // measure ending time
                  QueryPerformanceCounter(ref endTime);
  
                  // do some processing
                  test.DoSomeProcessing(endTime - startTime);
              }
          }
      }
  
      /// &lt;summary&gt;
      /// The PerformanceCounterSample class sets up a performance counter category called "JamboCpmTool" if it does not already
      /// exists and adds some counters to it. It provides a method to increment these counters.
      /// &lt;/summary&gt;
      public class PerformanceCounterSample
      {
          private PerformanceCounter m_cntrJoinConctConf_VPG_MyJamboLogin;
  
          public PerformanceCounterSample()
          {
              if (!PerformanceCounterCategory.Exists("JamboCpmTool"))
              {
                  CounterCreationDataCollection counters = new CounterCreationDataCollection();
  
                  CounterCreationData VPG_MyJamboLogin = new CounterCreationData();
                  VPG_MyJamboLogin.CounterName = "JoinConnectConf_VPG_MyJamboLogin";
                  VPG_MyJamboLogin.CounterHelp = "Join Connect Conf VPG MyJambo Login Success";
                  VPG_MyJamboLogin.CounterType = PerformanceCounterType.NumberOfItems64;
                  counters.Add(VPG_MyJamboLogin);
  
                  // create new category with the counters above
                  System.Diagnostics.PerformanceCounterCategory.Create("JamboCpmTool", "Sample category for Codeproject", PerformanceCounterCategoryType.SingleInstance, counters);
              }
  
              // create counters to work with
              m_cntrJoinConctConf_VPG_MyJamboLogin = new PerformanceCounter();
              m_cntrJoinConctConf_VPG_MyJamboLogin.CategoryName = "JamboCpmTool";
              m_cntrJoinConctConf_VPG_MyJamboLogin.CounterName = "JoinConctConf_VPG_MyJamboLogin";
              m_cntrJoinConctConf_VPG_MyJamboLogin.MachineName = ".";
              m_cntrJoinConctConf_VPG_MyJamboLogin.ReadOnly = false;
              m_cntrJoinConctConf_VPG_MyJamboLogin.RawValue = 0;
          }
  
          /// &lt;summary&gt;
          /// Increments counters.
          /// &lt;/summary&gt;
          /// &lt;param name="ticks"&gt;The number of ticks the AverageTimer32 counter must be incremented by&lt;/param&gt;
          public void DoSomeProcessing(long ticks)
          {
              m_cntrJoinConctConf_VPG_MyJamboLogin.RawValue = 100L;
              Console.WriteLine("m_cntrJoinConctConf_VPG_MyJamboLogin = " + m_cntrJoinConctConf_VPG_MyJamboLogin.RawValue);
          }
      }
  }
  </code></pre>