Adding Items to the combobox from the second form

G

Guest

Hello,

I have two forms (Form1 and Form2) . Form1 contains one Combobox and a button
which calls the second form on on_click event. In second form I have a
textbox and
a button. on click of this button i want to add a item in the Form1's
combobox.

How do i do this using c# in windows application. I am currently using
vs.net 2003.

Please Help.
 
M

Matthew Smith

I have two forms (Form1 and Form2) . Form1 contains one Combobox and a button
which calls the second form on on_click event. In second form I have a
textbox and
a button. on click of this button i want to add a item in the Form1's
combobox.

How do i do this using c# in windows application. I am currently using
vs.net 2003.

Add a public method to Form1 which will add a string to a combo box. You
can then call this method from Form2, however you need to have a
variable for Form1 somewhere. Perhaps you can have a constructor for
Form2 that has a parameter for passing Form1 to it.
 
G

Guest

Hello Smith

I have gone through the reply which you have sent. could you please send the
sample code for this. Hope it will helps me a lot.

ManyThanks
 
G

Guest

Hello Smith

I have worked in the way you said, like creating new sub for adding item into
combobox and its modifier is public. but still it is not working. Is there any
other alternate i can see it for working?

Hope to receive your response soon.

Many Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top