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

please follow this link: http://nexusfactor.webs.com/Lab.rar

THANK YOU A LOT IN ADVANCE!

Passing data between forms is probably the first noob question asked here, search the forum you will literally find HUNDREDS of posts about it, google it you will find Dozens of answers. Typically done with properties. you could also use a class with static members, or even pass data through the ctor. Its a very simple problem. here are a handful of suggestions.

http://www.vcskicks.com/data-between-forms.php

http://www.codeproject.com/KB/cs/pass_data_between_forms.aspx

http://msdn.microsoft.com/en-us/library/ms171925%28VS.80%29.aspx

http://www.c-sharpcorner.com/UploadFile/DipalChoksi/PassingDataBetweenaWindowsFormandDialogBoxes11242005035025AM/PassingDataBetweenaWindowsFormandDialogBoxes.aspx

http://www.c-sharpcorner.com/UploadFile/alindag/HowToPassValuesBetweenWindowsForms.htm02242006061520AM/HowToPassValuesBetweenWindowsForms.htm.aspx

http://www.youngcoders.com/net-programming/29915-how-pass-data-between-two-forms-c.html

http://www.dreamincode.net/forums/showtopic75208.htm

Not to be rude, but I don't understand when programmers can't get around this. Its a very simple problem, there is tons of material out there about it. I would use it as a bench march. If you can't pass your data between forms after 45 minutes of trying, Programming probably isn't for you.

Whilst his reply may sound harsh, i have to agree with diamonddrake on this one. I enjoy helping others to learn the finer points of coding and to overcome odd/challenging problems in their code. But there is an abundance of information (both here on Daniweb and on the internet in general) about this issue. The policy at daniweb is to show some effort before you ask for help.
So do a little reading and experiment with the code and if you get stuck on something specific we'll gladly help you to understand it.

This article has been dead for over six months. Start a new discussion instead.