Solved

VB.Net - DataTable Get Back to First Row

Posted on 2013-01-21
2
306 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

733 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