Bhavesh Vankar

Bhavesh Vankar

  • 725
  • 1.1k
  • 78.3k

How to pass record from DataGridview to Textbox ?

Aug 4 2022 10:57 AM

i have take one MDI for many child forms..

i have two page one is frmInvoice and second is frmSelectparty on MDI dashboard form....

Now i want to select client or party name and display party details like.... party code, party name, party gst no etc... on frmInvoice  form from frmSelectparty...

i have done code as below,,its working find but issue is after double click or select record using double click event from datagridview the below code is open frminvoice form seperatly and pass record on it.... but not pass on already opened form.....

the frmSelectparty form is open as a dialog see below code..

private void btnSelect_Click(object sender, EventArgs e)
{
    frmSelectParty partylist = new frmSelectParty();
    partylist.Text = "Select Party";
    partylist.ShowDialog();
}

kindly help me to solve this......

how to pass record on currently opened frmIvoice form from frmSelectparty form using window c#....

private void gvCustomer_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
    frmNewInvoice fr = new frmNewInvoice();
    int row = gvCustomer.CurrentRow.Index;
    fr.txtpartycode.Text = Convert.ToString(gvCustomer[0, row].Value);
    fr.txtpartyname.Text = Convert.ToString(gvCustomer[1, row].Value);
    fr.txtpartyaddress.Text = Convert.ToString(gvCustomer[2, row].Value);
    fr.txtpanno.Text = Convert.ToString(gvCustomer[3, row].Value);
    fr.txtgstno.Text = Convert.ToString(gvCustomer[4, row].Value);
    fr.ShowDialog(this.ParentForm);
    this.Hide();
    return;
}

 


Answers (5)