How to create DataSet without Databse

Dataset represents a collection of data retrieved from the Data Source. The DataSet contains DataTableCollection and their DataRelationCollection. The DataTableCollection contains zero or more DataTable objects. The data set may comprise data for one or more members, corresponding to the number of rows. We can fill the data in Dataset without calling SQL statements. For that we manually create a DataTable and add data in it.

Imports System.Data.OleDb
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ds As New DataSet
        Dim dt As DataTable
        Dim dr As DataRow
        Dim idCoulumn As DataColumn
        Dim nameCoulumn As DataColumn
        Dim i As Integer

        dt = New DataTable()
        idCoulumn = New DataColumn("ID", Type.GetType("System.Int32"))
        nameCoulumn = New DataColumn("Name", Type.GetType("System.String"))


        dr = dt.NewRow()
        dr("ID") = 1
        dr("Name") = "Name1"

        dr = dt.NewRow()
        dr("ID") = 2
        dr("Name") = "Name2"


        For i = 0 To ds.Tables(0).Rows.Count - 1
            MsgBox(ds.Tables(0).Rows(i).Item(0) & "   --   " & ds.Tables(0).Rows(i).Item(1))
        Next i

    End Sub
End Class