View Single Post
  #4 (permalink)  
Old March 3rd, 2010, 05:06 AM
Will Will is offline
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

Quote:
lstDisplay.Items.Add(rndm[n].ToString()); //Add each item to the listBox.
I woke up this morning and before I read this realised I had done something like this, so thats good I suppose.

Quote:
Indeed, there is really no reason to use a collection to do this. Simply use a regular for loop and index it directly. I think you'd also find this easier to read and understand six months from now, and that's always a good idea. Simple is best.
I find this with a lot of the code I am writing at the moment, I will look in the back of the book and there will be a much simpler way of achieving what I have done.

Like PeterPeiGuo's code which is a lot simpler.
__________________
Follow me on twitter.

Where I work.

Connect with me on LinkedIn

Blog