Hi, I am trying to add a row at the selected row but it keeps adding it to the end. I can't seem to figure it out, below is my code (some of it is custom code). I tried to modify last line 'fillgridrow' but can't figure out how to insert row
at the index selected.
private void button1_Click(object sender, EventArgs e)
{
DataGridViewRow dgr = dataGridView1.Rows[dataGridView1.CurrentRow.Index];
DataRow dr = itemsDT.Rows[(int)dgr.Cells["idx"].Value];
hiseq++;
AddRepeatItem(dr); //update sql query
GetNewItem(); //select new item sql query
if (newitemDT.Rows.Count == 0)
{
MessageBox.Show("Error writing repeat item entry. Call Systems. ");
}
DataRow dr2 = newitemDT.Rows[0];
//itemsDT.Rows.Add(dr2);
itemsDT.ImportRow(dr2);
FillGridRow(dr2, newitemDT.Rows.Count - 1);
}