Guys help me with this problem
I have two form Form1 contains Four ComboBox and Form2 contain one ComboBox and one Datagridview with three column.
When I mouseclick on One ComboBox in Form1 it displays Form1 and fill ComboBox that come from ComboBox (Form1) and fill DataGridView info that related to that ComboBox(Form2). So, When I click on one row in DataGridView (in Form2), the data from that row it passing to other three ComboBox in Form1.
When I do mouseclick on ComboBox in (Form1) it passing data to ComboBox in (Form2) and display the rows in DataGridview that related to ComboBox in (Form2), correctly. However, When I mouseclick on one row it does not pass that from DataGridView in (Form2) to three ComboBox in (Form1).
Please, I need your help.
What I have tried:
This is in Form1.
Display Form2 and Pass data to ComboBox (Form1)
<pre>private void ComboBox1_MouseClick(object sender, MouseEventArgs e)
{
Form2 f2 = new Form2(this.ComboBox.Text);
f2.MdiParent = this.MdiParent;
f2.Show();
}
this Function it return the Data from DataGridView (Form2) to Form1
public Form1(string Data1, string Data2, string Data3)
{
InitializeComponent();
this.ComboBox1.Text = Data1;
this.ComboBox2.Text = Data2;
this.ComboBox3.Text = Data3
this.ActiveControl = this.ComboBox1;
}
=======================================
In Form 2 this is Code:
Get data from Form1
public Form2(string Data1)
{
InitializeComponent();
this.ComboBox.Text = Data1;
}
This is when I send data to Form1
private void DataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
Form1 F1 = new Form1(this.DataGridView1.CurrentRow.Cells[0].Value.ToString(),
this.DataGridView1.CurrentRow.Cells[1].Value.ToString(), this.DataGridView1.CurrentRow.Cells[2].Value.ToString(),
}