Q:

Stored list of array using For Each loop

I want to store the "zone_check_value" to a array of string then while inserting into array i will check the array of string if the next value is repeated or have duplicate.
Example.
1st Example
    1st loop = zone_check_value = ZD1/01/2014
    2nd loop = zone_check_value = ZD1/01/2014
2nd Example
    1st loop = zone_check_value = ZD1/01/2014
    2nd loop = zone_check_value = ZD2/02/2014
    3rd loop = zone_check_value = ZD1/01/2014

Code:
 For Each dt As DataTable In xls.Tables
   Dim array_of_string as String() 'i want to put the value in here
    For Each dr As DataRow In dt.Rows
        Dim zone_destination As String = dr(2).ToString
        Dim affected_date As String = dr(7).ToString
        Dim zone_check_value = zone_destination + affected_date
        ''''''How can i store zone_check_value in a string array?
    Next
Next

EDIT
What if i add select case in my loop? the array_of_string value become NULL. I need to check the value of the current value in array_of_string .
Example Code
 For Each dt As DataTable In xls.Tables
   Dim array_of_string as String() 'i want to put the value in here
   select Case dt.tablename
    case "Sheet1"
      For Each dr As DataRow In dt.Rows
        Dim zone_destination As String = dr(2).ToString
        Dim affected_date As String = dr(7).ToString
        Dim zone_check_value = zone_destination + affected_date
        ''''''How can i store zone_check_value in a string array?
      Next
    case "Sheet 2"
      For Each dr As DataRow In dt.Rows
         Dim check_value as Boolean = array_of_string.Contains(dr(0).ToString)
         'but when i got in sheet 2 the array_of_string is null
      Next
Next

A:

The easiest way is to use a List(Of String).
For Each dt As DataTable In xls.Tables
   Dim array_of_string as List(Of String) = New List(Of String) 'i want to put the value in here
    For Each dr As DataRow In dt.Rows
        Dim zone_destination As String = dr(2).ToString
        Dim affected_date As String = dr(7).ToString
        Dim zone_check_value = zone_destination & affected_date
        ''''''How can i store zone_check_value in a string array?
        array_of_string.Add(zone_check_value)
    Next
    ''' Now if you really need it in array form you can cast it via:
    ''' Dim values() As String = array_of_string.ToArray()
Next

You might even consider:
For Each dt As DataTable In xls.Tables
  Dim values As List(Of String) = New List(Of String)
  dt.Rows.ForEach( Sub(item) values.Add(item(2).ToString & item(7).ToString) )
  ''' Now do something with values.
Next

Either way, make sure you always use the string concatenation operator & to concatenate strings.  The arithmetic addition operator + will cause you problems from time to time if you use it on strings.

