Error is here line 11 and line 12
row = (DataGridViewRow)roba_uslugeDataGridView.SelectedRows[i].Clone();
int intColIndex =
0;
Some help?
- Private void roba_uslugeDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- DataGridViewRow row = new DataGridViewRow();
-
- for (int i = 0; i < roba_uslugeDataGridView.Rows.Count; i++)
- {
- row = (DataGridViewRow)roba_uslugeDataGridView.SelectedRows[i].Clone();
- int intColIndex = 0;
-
- foreach (DataGridViewCell cell in roba_uslugeDataGridView.SelectedRows[i].Cells)
- {
- var ColIndex = dataGridView1.Rows.Add();
- dataGridView1.Rows[intColIndex].Cells["redni_broj"].Value = intColIndex + 1;
- dataGridView1.Rows[intColIndex].Cells["bar_kod"].Value = cell.Value.ToString();
- dataGridView1.Rows[intColIndex].Cells["sifra"].Value = cell.Value;
- dataGridView1.Rows[intColIndex].Cells["naziv_artikla"].Value = cell.Value;
- dataGridView1.Rows[intColIndex].Cells["cijena"].Value = cell.Value;
- dataGridView1.Rows[intColIndex].Cells["kolicina"].Value = "1";
- foreach (DataGridViewRow g1 in dataGridView1.Rows)
- {
- g1.Cells["ukupno"].Value = (Convert.ToDouble(g1.Cells["kolicina"].Value) * Convert.ToDouble(g1.Cells["cijena"].Value)).ToString("0.00");
- }
- row.Cells[intColIndex].Value = cell.Value;
- intColIndex++;
- }
- dataGridView1.Rows.Add(row);
- }
- dataGridView1.AllowUserToAddRows = false;
- dataGridView1.Refresh();
-
- }