Solved

MOve items from returned datatable to new datatable

Posted on 2013-06-25
6
208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

729 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