The following code is not entering the i for loop. I have had problems with my computer and VS2010. Is this a coding issue (I am a vb.net programmer programing c#.net) or a vb install issue? 开发者_StackOverflow
for(int hi = 1; hi > 10; hi++)
{
reply = pingsender.Send(ip, 500, buffer, options);
avgtime += reply.RoundtripTime;
}
//EDIT:
//All code except for issue taken offline due to company policy
//sorry for any inconvience
This code is nested in four for loops (that all work) and is runnin, and is meant to put ping statistics in a list box. Sorry for the messy code, I comment and clean after I get the code working.
Thank you in advance for all of your hard work!
for(int hi = 1; hi > 10; hi++)
will never be true; fails at the first test, as 1
is not > 10
.
The middle clause is (essentially) "while" - not "until". I suspect you need < 10
(for 9 iterations) or <= 10
(for 10 iterations).
It's hard to guess why the code isn't entering your for loop. (Especially since the code is just a snippet of the problem.)
I'd suggest that you place a breakpoint on your for loop, then check what the variables are set to. It's always helpful to use your debugger for diagnosis.
Cheers!
精彩评论