title: Vb.net Gridview "pointer"?
body: <p>I have code that interacts with a gridview, and the code is exactly the same for multiple gridviews. So can I do something like this:</p>
  
  <pre><code>Dim gridViewPointer As GridView
  
          If (gridViewNumber = 1) Then
              gridViewPointer = GridView1
          ElseIf (gridViewNumber = 8) Then
              gridViewPointer = GridView8
          ...
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>If (gridViewPointer.DataSourceID = SQLDatasourcetemp.ID) Then
  ...
  </code></pre>
  
  <p>Will this work or is there another way to do this?</p>
  
  <p>Edit:
  I'm checking to make sure that the data the user is inputting into the gridview is correct. It could be one of 4 gridviews, and the checks are exactly the same, the only parameter that changes in the code is gridview1/gridview2/etc. So if I can use a "pointer" to the correct gridview then I can elimninate all the duplicate code.</p>