3
Answers

PASSING DATA BETWEEN TWO FORMS BACK AND FORTH

Thomas Anderson

Thomas Anderson

14y
6.2k
1
hello. i have problem with c# multiple form app. in my first form i have a combo box, a list, a text box and an add item button. in the combo box i have a list of products. once i choose a product from combo box and enter the quantity in the text box, it will show up on my list. but if i click on an empty string from combo box such as "" and click on add item, it will take me to a subform where i can put in the specifications of the product. in the second form i have the product name and other specifications. i also have an update button when the name of the product in the second form's text box is entered and update button is clicked, it should upload the name of the product to the first form's combo box.

usually when u want to pass data u have the driver class, there u create an object of the first form and once in the first form, u create an object of the second form and pass the first form's values into the second form. but in this case its different. you are creating an object of the first form in the driver class. then once the user is in the first form and clicks add item for a blank string in the combo box, an object of the second form is created. once product name is entered into the second form and the update button is clicked the data has to be passed back to the first form. so it is back and forth.

here is my code

my code is attached

THANK YOU A LOT IN ADVANCE!

Attachment: Lab.rar

Answers (3)