Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
4
Answers
Automatically Populate form from text box value when it opens
Derek Wharton
16y
5.3k
1
Reply
Here is a newbie question for you.
I have a main form that opens a second form like this
private void button2_Click(object sender, EventArgs e)
{
Form3 form3 = new Form3();
form3.employeenumberToolStripTextBox.Text = employeeNumberTextBox.Text;
form3.Show();
form3.Owner = this;
}
When form3 opens, I have to click the enter button again (has the information from form1 textbox) to populate the form. How can I automatically have the click event activated when the form opens instead of having to click the enter button?
Does this make sense?
My form3 looks like this:
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void sp_CLE_SelectRowBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.sp_CLE_SelectRowBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.employee_DataDataSet);
}
private void button1_Click(object sender, EventArgs e)
{
try
{
this.sp_CLE_SelectRowTableAdapter.Fill(this.employee_DataDataSet.sp_CLE_SelectRow, new System.Nullable<int>(((int)(System.Convert.ChangeType(employeenumberToolStripTextBox.Text, typeof(int))))));
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Unable to load one or more of the requested types
name resolution issue