Solved

MOve items from returned datatable to new datatable

Posted on 2013-06-25
6
203 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

20 Experts available now in Live!

Get 1:1 Help Now