Solved

Delete Row from DataTable (C#)

Posted on 2006-07-08
2
1,121 Views
Last Modified: 2007-12-19
Hi,
 I need a help tp write a funtion that gets a parametrs number of Row as R and DataTable as dt
The Function return a new table without the Row number R.

Thanks
0
Comment
Question by:madmare
2 Comments
 
LVL 6

Expert Comment

by:MuhammadAdil
ID: 17067243
Hello Dear

Pass RowIndex and DataTable it return DataTable without That row

public DataTable DelRow(int RowIndex, DataTable dt)
        {
            dt.Rows[RowIndex].Delete();
            return dt;
        }
0
 
LVL 1

Accepted Solution

by:
flashaoy earned 500 total points
ID: 17082218

DataTable Delete(DataTable table,int index )
{
            table.Rows[index ].Delete();
            return table;
}
DataTable  table=Delete(DataTable1 ,2);
or  u can use this

this peter >>>>
void Delete(ref DataTable table,int index )
{
            table.Rows[index ].Delete();
}
-----------
Delete(ref DataTable1 ,2);

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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