Dear All,
Please need your support i am trying to update datagriviwe from another form textbox but cannot please need your support.
Below for you refrence.

private void btntupdate_modify_Click(object sender, EventArgs e)
{
try
{
POS form1 = new POS();
DataGridView Main_dg = (DataGridView)form1.Controls["dataGridView1"];
for (int i = 0; i < Main_dg.Rows.Count; i++)
{
Main_dg.Rows[i].Cells[2].Value = txtupdate_grampcs.Text;
Main_dg.Rows[i].Cells[3].Value = txtupdate_unitprice.Text;
Main_dg.Rows[i].Cells[4].Value = txtupdate_total.Text;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Feroz KhanPosted Feb 5, 2023, 11:54 AM
Dear Sachin,
Thank you for your reply.
But issue you can see below snap when i double click the griview row data is coming from same row in another form textbox but when i am updating showing error like below.
Error
Sachin SinghPosted Feb 2, 2023, 3:14 PM
create a class file in your project as
In Form 2 (where you have textboxes) set the above fields as
in First form (Where you have DataGridView)