'Can't insert data in the same previous form - I lose data when I create a new form
My problem is that when I choose a row in my datagridview, it opens a new form, not the previous one.
Here is my code:
Button: "choix de l'article" in "Form1" : f2 to call form2
public partial class A_commande : Form
{
public A_commande()
{
InitializeComponent();
}
private void button12_Click(object sender, EventArgs e)
{
A_fournisseur_article f2 = new A_fournisseur_article();
f2.Show();
}
}
Form2: f1 to call form1
private void articleDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.RowIndex >= 0)
{
A_commande f1 = new A_commande();
DataGridViewRow row = this.articleDataGridView.Rows[e.RowIndex];
f1.articleComboBox.Text = articleDataGridView.CurrentRow.Cells[0].Value.ToString();
f1.catégorieTextBox.Text = articleDataGridView.CurrentRow.Cells[1].Value.ToString();
this.Hide();
f1.Show();
}
}
(My problem): it's not "form1" but I get "new form1"
Thank you so much for your time.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
