Solved

Delete Row from DataTable (C#)

Posted on 2006-07-08
2
1,118 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

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…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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