Hai ,I have 2 forms form1 has button(btn_ok),datagridview has some rows.and form2 has 3 testboxes and a button(btn_newbill) if i press from2 button then form1 should be displayed and their if i select any row of my choice then that row columns should be displayed in form2 textboxes.Thank you
Loading
Leon PuthPosted May 15, 2014, 8:19 AM
form1 where your grid sits. this will send data back to form 2:
public partial class Form1 : Form
{
public delegate void mydelegate(string message);
public event mydelegate myEvent;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
myEvent("some data");
}
}
form2 which calls form1 and expects to receive data from it:
public partial class Form2 : Form
{
private int counter = 0;
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 myform = new Form1();
myform.myEvent += respondEvent;
myform.Show();
}
private void respondEvent(string message)
{
counter++;
this.button1.Text = counter.ToString();
}
}