Solved

Delete Row from DataTable (C#)

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

Suggested Solutions

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

713 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