Solved

MOve items from returned datatable to new datatable

Posted on 2013-06-25
6
207 Views
Last Modified: 2013-06-26
In VB.NET
I have a function that fills a private datatable

        returnedPhoneTable = getPhoneListDT()

It is then bound to a GridView
        rgvData.DataSource = returnedPhoneTable.DefaultView

What I would like to do is on a button click, one by one, move the records to a list box
0
Comment
Question by:lrbrister
  • 3
  • 3
6 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39277326
the records from the datatable has fields, which field u want to display in the listbox?
also, upon button click, do u want to loop through the datatable and add all of them to the listbox?
what do u mean one by one?
0
 

Author Comment

by:lrbrister
ID: 39277562
One field, phoneNumber

One by one means row by row
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39277647
For Each row In returnedPhoneTable.Rows
listbox.Items.Add(row("phoneNumber"))
Next

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lrbrister
ID: 39277749
I want to move them row by row and
REMOVE them from the datatable
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39277758
dim row = returnedPhoneTable.Rows(0)
listbox.Items.Add(row("phoneNumber"))
returnedPhoneTable.Rows.RemoveAt(0)

Open in new window

0
 

Author Closing Comment

by:lrbrister
ID: 39277969
Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

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