• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

VB.Net - DataTable Get Back to First Row

Good Day Experts!

I am having trouble with this seeminlgy simple task.  I am converting a VB6 program that had a Do/Loop that ran a query each time through.  If certain data was encountered the loop is exitied.  Then the Do/Loop Reordset is reset back to the beginning with .MoveFirst.  

So, In my conversion I have:

DataTable that I am iterating through using a For/Next loop.  In it I run a query which may contain data that requires exiting from the loop.  

After I exit from the loop, I need to get back to the first row of the DataTable so I can iterate through it again.

How can I achieve this?

Thanks,
jimbo99999
0
Jimbo99999
Asked:
Jimbo99999
1 Solution
 
CodeCruiserCommented:
Then run the foreach loop again. Or use the for next loop and reset the counter to 0.
0
 
Jimbo99999Author Commented:
Thanks...I was staring at the For Each and "forgot" about the For Next with the counter.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now