View Single Post
Old 09-02-2011, 09:30 PM  
tical
Confirmed User
 
Join Date: Feb 2002
Location: Las Vegas
Posts: 6,504
Quote:
Originally Posted by acctman View Post
am i doing this correctly, trying replace the pre-loaded entries from your example with my actual listboxs for loading/processing

Code:
List<string> listId = new List<string>();
foreach(var item in this.listId.Items)
{
    listId.Add(item.ToString());
}
List<string> listCell = new List<string>();
foreach(var item in this.listCell.Items)
{
    listCell.Add(item.ToString());
}


int listCellCounter = 0;
            for (int x = 0; x < listId.Count; x++)
            {
                Debug.WriteLine("something " + listId[x] + " " + listCell[listCellCounter]);
                if (listCellCounter == listCell.Count() -1)
                {
                    listCellCounter = 0;
                }
                else
                {
                    listCellCounter += 1;
                }
            }
Actually you don't need to pre-populate a list. You should be able to use your existing collections:

Something like this, my sytax may be off a bit... but it should be clear! Hope that helps

Code:
            int listCellCounter = 0;
            for (int x = 0; x < listId.Items.Count; x++)
            {
                Debug.WriteLine("something " + listId.Item[x] + " " + listCell.Item[listCellCounter]);
                if (listCellCounter == listCell.Items.Count() -1)
                {
                    listCellCounter = 0;
                }
                else
                {
                    listCellCounter += 1;
                }
            }
__________________
112.020.756
tical is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote