Listing repeated items in C # is very easy. You just need to put the following code under the button:
List repeated items
1 private void btndouble_Click (object sender, EventArgs e)
2 {
3 if (dt_tmp = null)
4 {
5 return;
6}
7 DataTable dt_New = dt_tmp.Clone ();
8 int count = 0;
9 foreach (DataRow item in dt_tmp.Rows)
10 {
11 foreach (DataRow row in dt_tmp.Rows)
12 {
13 if (item ["Product Information"]. ToString (). Trim () = row ["Product Information"]. ToString (). Trim ())
14 {
15 count ++;
16}
17}
18 if (count> = 2)
19 {
20 dt_New.ImportRow (item );
21}
22 count = 0;
23}
24 if (dt_New = null)
25 {
26 return;
27}
28 rescdgv (dgvorders, dt_New );
29 // sort by "product information"
30 dgvorders. Sort (dgvorders. Columns ["Product Information"], ListSortDirection. Descending );
31}
Click a column in dgv to copy the product information, for example:
Copy information
// Click DGV to copy the phone number in the row to the clipboard.
Private void dgvorders_CellClick (object sender, DataGridViewCellEventArgs e)
{
If (e. RowIndex! =-1)
{
String value = dgvorders. CurrentRow. Cells ["Product Information"]. Value. ToString ();
Clipboard. SetText (value );
}
}