[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

MOve items from returned datatable to new datatable

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
lrbrister
Asked:
lrbrister
  • 3
  • 3
1 Solution
 
Meir RivkinFull stack Software EngineerCommented:
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
 
lrbristerAuthor Commented:
One field, phoneNumber

One by one means row by row
0
 
Meir RivkinFull stack Software EngineerCommented:
For Each row In returnedPhoneTable.Rows
listbox.Items.Add(row("phoneNumber"))
Next

Open in new window

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
lrbristerAuthor Commented:
I want to move them row by row and
REMOVE them from the datatable
0
 
Meir RivkinFull stack Software EngineerCommented:
dim row = returnedPhoneTable.Rows(0)
listbox.Items.Add(row("phoneNumber"))
returnedPhoneTable.Rows.RemoveAt(0)

Open in new window

0
 
lrbristerAuthor Commented:
Thanks
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now