Blake81
Well-known member
I'm trying to get a program going for work to help track down some possible viruses and general performance issues. I haven't used the PerformanceCounter before, and I would like to get different values without hard coding the categories that I'm looking for. How can I change the category dynamically? Also, I'm confused about InstanceName and CounterName. If, for example, I want to track memory usage, UDP, and TCP connections, could I do that with just one Performance counter or would I need three? I got some of these values to display in a label on a timer, but some of them will not. I would appreciate any help. Here's one of the things I tried (with memory usage hard coded as the category)
[/COLOR][/SIZE]
VB.NET:
[SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Timer1_Tick([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Timer1.Tick
PerformanceCounter1.BeginInit()
Label9.Text = PerformanceCounter1.RawValue
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]