How do I convert an ArrayList to a dataset?

Posted on 2006-06-08
Last Modified: 2012-08-13

I have an ArrayList holding a specific object type. I need to convert into a dataset so I can write it to an .xml file format and then export it to a report. Anyone know how to do this?

Thank you,

Question by:sacul
    LVL 7

    Accepted Solution

    Hello Zac,
    I think this is your solution:

    Dim dsTemp As DataSet = New DataSet
    Dim dTbl As New DataTable

    Dim arr As New ArrayList
    Dim str As String

    For Each str In arr
        Dim dRow As DataRow
        dRow = dTbl.NewRow()
        dRow("myColumn") = str


    hope this helps.  Good luck.

    LVL 6

    Expert Comment

    Couple of questions

    1. What object type is held
    2. Why don't you simply loop thru your arraylist and build the XML format


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    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’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    755 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

    17 Experts available now in Live!

    Get 1:1 Help Now