Solved

VB.Net - DataTable Get Back to First Row

Posted on 2013-01-21
2
305 Views
Last Modified: 2013-01-21
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
Comment
Question by:Jimbo99999
2 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 395 total points
ID: 38802621
Then run the foreach loop again. Or use the for next loop and reset the counter to 0.
0
 

Author Closing Comment

by:Jimbo99999
ID: 38802664
Thanks...I was staring at the For Each and "forgot" about the For Next with the counter.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question