Solved

MOve items from returned datatable to new datatable

Posted on 2013-06-25
6
205 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Latency in .net app using DB in .net 21 65
ASP.NET MVC 2 31
Footer for each row on Gridview 2 21
How to seperate number and letters from a string 3 11
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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