Manikavelu Velayutham
posted
682 posts
since
Jun 25, 2010
from
|
|
Re: Displaying forms 2&3 from a combo box on form 1
|
|
|
|
|
|
|
|
|
|
|
You should write you code in on selected index changed event of the combo box in form 1.
There you need to create an instance of the Form2 Or Form3 based on the selection of the combo box.
Finally you should show the form using Form2.Show or Form3.Show
|
|
|
|
|
If you find my post helpful, Mark it as Answered or Rate the post.
|
|
|
|
|
|
Frank Mills
posted
4 posts
since
Sep 09, 2010
from
|
|
Re: Displaying forms 2&3 from a combo box on form 1
|
|
|
|
|
|
|
|
|
|
|
I'm not sure how to create an instance based on the combo box selection. Right now, I have figured out how to connect the combo box to another form, but not each individual value within the combo box. In other words, no matter what value I choose within the combo box, I simply end up on Form 2.
|
|
|
|
|
|
Manikavelu Velayutham
posted
682 posts
since
Jun 25, 2010
from
|
|
Re: Displaying forms 2&3 from a combo box on form 1
|
|
|
|
|
|
|
|
|
|
|
Form2 objForm2 = new Form2();
objForm2.Show();
Hope this code would help you.
|
|
|
|
|
If you find my post helpful, Mark it as Answered or Rate the post.
|
|
|
|
|
|
Frank Mills
posted
4 posts
since
Sep 09, 2010
from
|
|
Re: Displaying forms 2&3 from a combo box on form 1
|
|
|
|
|
|
|
|
|
|
|
Form2 objForm2 = new Form2(); objForm2.Show();
This particular string of code does help me to access Form2 from Form1, however, my problem is that I have 3 forms and I need to be able to access Form 2 and 3 from a combo box on Form 1. Therefore, if I simply plug in the above string of code, any value that I choose within the combo box only takes me to form 2. How do I make it so that selecting "form 1" or "form 2" from within the combo box will open the corresponding form?
|
|
|
|
|
|
Manikavelu Velayutham
posted
682 posts
since
Jun 25, 2010
from
|
|
Re: Displaying forms 2&3 from a combo box on form 1
|
|
|
|
|
|
|
|
|
|
|
Hope this code would help you a lot and dont forget to mark this answer. if (comboBox1.SelectedItem.ToString().Equals("Form2")) { Form2 objForm = new Form2(); objForm.Show(); } else if (comboBox1.SelectedItem.ToString().Equals("Form3")) { Form3 objForm = new Form3(); objForm.Show(); }
|
|
|
|
|
If you find my post helpful, Mark it as Answered or Rate the post.
|
|
|
|
|
|
Manikavelu Velayutham
posted
682 posts
since
Jun 25, 2010
from
|
|
Re: Displaying forms 2&3 from a combo box on form 1
|
|
|
|
|
|
|
|
|
|
|
Sample application is uploaded. Enjoy.
|
|
|
|
|
If you find my post helpful, Mark it as Answered or Rate the post.
|
|
|
|
|
|