Results 1 to 2 of 2

Thread: add Listbox Items to a DataSet or DataTable

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Location
    Santo Domingo, Dominican Republic
    Posts
    43

    Post add Listbox Items to a DataSet or DataTable

    Hey Guys, i want to add all the items of a Listbox to a DataSet or a DataTable.
    My goal is to then add all those items to a Table in my DataBase.

    How can i do that? ive lost 2 hours today trying to do that.

    Oh and im working in C# there..

    thx


    Post OriginalPosted on ASP.NET but since im desperate i posted here also

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: add Listbox Items to a DataSet or DataTable

    Loop through all the items in the ListBox, create a NewRow for the DataTable and add the item's string value from the ListBox. Does this DataTable already exist? If not, you need to create a new DataTable and Add Columns first. I'd suggest reading up about the DataTable class and its members. Take a look at some of the tutorial links in my signature for ADO.NET information.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width