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:
Dim gridViewPointer As GridView
If (gridViewNumber = 1) Then
gridViewPointer = GridView1
ElseIf (gridViewNumber = 8) Then
gridViewPointer = GridView8
...
and then
If (gridViewPointer.DataSourceID = SQLDatasourcetemp.ID) Then
...
Will this work or is there another way to do this?
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.