title: How do I solve an 'End of statement expected' compiler error for a VB 'If` statement?
body: <p>I'm not too good in VB.net, mostly working with C#, and I have the following <code>foreach</code> loop:</p>
  
  <pre><code>Dim pSources() As Integer = {}
  pSources = SCCC.GetSources(SysCompany, SysUser, ccHeaderId)
  
  Try
  
      For Each intSelect As Integer In pSources 
  
          For Each li As ListItem In chkSources.Items 
  
              If Convert.ToInt32(li.Value) Equals(intSelect)
                  li.Selected = True
              End If
  
          Next
  
      Next
  
  Catch ex As Exception
  
  End Try
  </code></pre>
  
  <p>I would like to check for each item in the <code>pSources</code> array of <code>Integer</code>, to find the appropriate value in the list of checkboxes and check the checkbox if the value match.</p>
  
  <p>With the code I have at this moment I'm getting error on the line where I do the if comparison, and this is the error:</p>
  
  <blockquote>
    <p>End of statement expected</p>
  </blockquote>
  
  <p>How can I fix this? </p>
  
  <p>Or maybe better, how I can use a LINQ statement which will check for the value and then check the checkboxes if the value is contained in the <code>pSources</code> array?</p>