I believe tablenum is being dimmed as a variant since you didn't specify a type, unless that's different in .NET than VB6. Looks like they should be integers too:
Dim tablenum As Integer, var As Integer
And rather than doing the Do...Loop Until 1 = 2, you can just do Do...Loop
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.