I'm not sure which part is marked null. I want to transfer data from a form called Need to a form called Coach. The data information is sent directly to the SetActionValuse of Coach and to the Money text box as soon as it is entered in the text box called taketimes. Thank you to coach my code..
This is Need Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public delegate void DataPushEventHandler(string value);
//public delegate void DataGet(string value);
public partial class Need : Form
{
public DataPushEventHandler datasendE;
public Need()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
this.Visible = false;
Main newform = new Main();
newform.Show();
}
private void taketimes_TextChanged(object sender, EventArgs e)
{
datasendE(taketimes.Text);
}
private void button1_Click(object sender, EventArgs e)
{
Coach newform = new Coach();
this.datasendE += new DataPushEventHandler(newform.SetActionValuse);
//this.Visible = false;
newform.Show();
}
}
}
This is Coach form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Coach : Form
{
string sendData;
public Coach()
{
InitializeComponent();
}
public void SetActionValuse(string para)
{
money.Text = para;
}
private void button1_Click(object sender, EventArgs e)
{
this.Visible = false;
Main newform = new Main();
newform.Show();
}
private void money_TextChanged(object sender, EventArgs e)
{
}
private void Coach_Load(object sender, EventArgs e)
{
// money.Text = sendData;
}
}
}