?
Solved

how to delete a row from a datatable

Posted on 2005-03-03
2
Medium Priority
?
341 Views
Last Modified: 2010-04-23
I currently want to delete a row from a datatable. I am identiyiny the row by using the find method on a item in a listbox. Can someone tell me how i can delete the row from the datatable dtheldbatch


            Dim dr As DataRow = dtHeldBatch.Rows.Find(ListBoxPostBatch.ValueMember)
0
Comment
Question by:anwarmir
[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
2 Comments
 
LVL 1

Expert Comment

by:JAMU
ID: 13450731
Hi,

after you have identified the row u can delete it like eg.

Dim dt As New DataTable
 dt.Rows(0).Delete()

This should work fine.

--JAMU--
0
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 1000 total points
ID: 13456439
Just say
dr.Delete
that's it

Since the DR points to the particular Row in your dataTable dtHeldBatch, a dr.delete will actually delete the row from the DataTable dtHeldBatch
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

771 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