How to move to the First Record of DataSet

Posted on 2006-05-11
Last Modified: 2012-06-27
How do I move to the first row in a DataSet?

For Each row In DataSet1.Tables(0).Rows
            . . . .
            . . . .
>>>> need to move to the next row here . .  

Question by:MikeMCSD
    LVL 28

    Accepted Solution

    Private Sub btnReadDS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReadDS.Click
            'read the whole dataset
            Dim iRow As Integer
            Dim iCol As Integer
            Dim sRowValue As String

            For iRow = 0 To ds.Tables(0).Rows.Count - 1
                For iCol = 0 To ds.Tables(0).Columns.Count - 1
                    sRowValue &= ds.Tables(0).Columns(iCol).ToString() & ": " & ds.Tables(0).Rows(iRow).Item(iCol) & " "
                sRowValue &= vbCrLf
    End Sub

    basically if you want o read the first row value it will be
    LVL 16

    Author Comment

    thanks for that . . .
    I made a mistake:
    >>>> need to move to the next row here . .  
    should have been:
    >>>> need to move to the FIRST row here . .  

    I need to move to the first row of the dataset before the "Next" . .

    After the row is added, I get this error:
    "collection modified . . enumeration my not operate" . .
    so I need to move to the first record, I guess . .

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now