network adapter help

™blade™

Golden Oldie
Golden Oldie
Oct 31, 2004
799
1
125
hi all just started learning c# from youtube and other websites

ive started making a little system monitor some thing simple that i can get used to what does what
ive got the cpu % and a speech warning when it hit like 80 and 100. also got ram to display to
ive started trying to add my network to so incoming and out going data but just can't seem to find a away to get performancecounter to work. ive also tried.


Code:
        long preBytesSend = 0;        long preBytesRec = 0;


        long DSpeed, USpeed;


        IPv4InterfaceStatistics iFace;



private void timer3_Tick(object sender, EventArgs e)
         {
            network.Text = "Network Usages: " +(int)performanceCounter3.NextValue(); t[COLOR=#b22222]ried this but the performancecounter dont seem to print to screen like my cpu and ram ones[/COLOR]


[COLOR=#008000]            /*iFace = NetworkInterface.GetAllNetworkInterfaces()[0].GetIPv4Statistics();[/COLOR]
[COLOR=#008000]
[/COLOR]
[COLOR=#008000]            USpeed = (iFace.BytesSent - preBytesSend) / 1024;[/COLOR]
[COLOR=#008000]          DSpeed = (iFace.BytesReceived - preBytesRec) / 1024;[/COLOR]
[COLOR=#008000]    preBytesSend = NetworkInterface.GetAllNetworkInterfaces()[0].GetIPv4Statistics().BytesSent;[/COLOR]
[COLOR=#008000]  preBytesRec = NetworkInterface.GetAllNetworkInterfaces()[0].GetIPv4Statistics().BytesReceived;[/COLOR]
[COLOR=#008000]
[/COLOR]
[COLOR=#008000]            //    d_ld.Text = "Download: " +Math.Round((double)DSpeed,2) + "KB/s";[/COLOR]
[COLOR=#008000]            //    u_ld.Text = "Upload: " +Math.Round((double)USpeed,2) + "KB/s";
  */

[/COLOR][COLOR=#a52a2a]and this one does the same will not display on  screen. ive been trying to use a combobox to select the network adapter but cant find a tut for it.[/COLOR][COLOR=#008000]
[/COLOR]
            }

I would be very greatfull for any help given