How would I go about inserting the text that I have entered in to the textbox in NewActivity into the first column in the datagridview on form1?
Here is the coding I have thus far.
Form1
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.IsMdiContainer = true;
}
private void viewToolStripMenuItem1_Click(object sender, EventArgs e)
{
}
private void newActivityToolStripMenuItem_Click(object sender, EventArgs e)
{
NewActivity NewAc = new NewActivity();
NewAc.MdiParent = this;
NewAc.Show();
}
private void deleteActivityToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}
NewActivity
public partial class NewActivity : Form
{
public string activityName;
public NewActivity()
{
InitializeComponent();
}
private void btnCancel_Click(object sender, EventArgs e)
{
activityName = "";
this.Close();
}
private void btnAddActivity_Click(object sender, EventArgs e)
{
activityName = txtActivityName.Text;
this.Close();
}
}
}
Here is an example of how to bind data from a textbox control to a DataGrid
---------------Below is how you would use it in your case--------------------