Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping around items in an Arraylist

Status
Not open for further replies.

lsmyth1717

Programmer
Mar 25, 2005
44
GB
I have an array list alSearchCriteria which contains values which vary each time its created. It will always have 15 items in the arraylist each time its created. Some of the values in the array list will be a string called null. I want to create some way of looping through the arraylist and pulling back all the values which aren't null and displaying them on some control like a asp:label in .net.

Does anyone know how I could write such a loop in c# and is this the best way of doing it.

So basically to summarise I need to write a loop which goes around my arraylist and prints all the values which are not null to a label contol. Could someone please help me with this.
 
Look at using the [tt]foreach[/tt] statement with a test to see if the value you're looking for is null.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top