Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

C# Copy one Datagrid Row to another Row, Excel import

$
0
0

Trying to copy one datagrid row to another row, below code copies a hard coded number to another row. I need to copy say cell 7 row to cell 10 row.

 private void btn_Adjust_Click(object sender, EventArgs e)

        {
            dataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing;                                       
            for (int i = 0; i < dataGridView1.RowCount; i++)
            {

                if (dataGridView1.Rows[i].Cells[18].Value.ToString() == "Yeshh")
            {
                dataGridView1.Rows[i].Cells[9].Value = "48";
                dataGridView1.Rows[i].Cells[8].Value = "45";


Booney440


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>