Hello Erika,
There are a lot of ways to connect between your two Forms, and the way you should go is up to your requirements.
To have a link between the 2 Forms, one of them should have a reference of the other, so you may declare and instantiate Form#2 from Form#1, for example on the Form#1 loaded event handler:
1. Go create Form1 and Form2.
2. Inside the code behind of Form1. Declare Form2 as a member.(just like any class or struct)
3. Double click on Form1, this will add an event handler to the code behind.
- private void Form1_Loaded(object sender, RoutedEventArgs e)
-
{
-
}
4. Show Form2.
5. Now there is a link between the two Forms, so go and create a public Method inside Form2.
- public void AddToComboBox(string fromTextBox)
-
{
-
// here is the code to make whatever you want..
-
}
6. On Form1 on the event handler of your button, access that Method by adding to it the value of the Text property of the TextBox.
- f2.AddToComboBox(TextBox1.Text);
Hope that will help.