1
Hello. I am working on an application that should work as follows: When running, a main form (Form1) should open and always remain in the background. This main form contains options for the user to make their choices through a button with the text "add". When the user clicks on the "add" button, he must open another form (Form2) in which the user must place his information in textbox and then click on a button with the "save" text. By clicking the "save" button Form2 should be closed. The main form should always be open at the bottom. The user will have other options in the main form that he can choose to fill through other Forms (Form3, Form4...Formn) and whenever he clicks "save" in the Forms they will be closed remaining only the Form1.
In Form1 you will have a "generate report" button that when you click on it you will have to export all the data saved in the other Forms to an Excel spreadsheet.
I already built the application with all Forms and code to generate the report.
The question is: How do I send data from other Foms to Form1 when it will be closed or will be closed when the user clicks "save" ??
I have tried several communication alternatives between Forms but without success. I have checked all options only work if I give a command . show() and open the main form again...but in my application this cannot be done...
How do I save data without having to open Forms again...??
Confused your question, I even know the communication response between form but, the auxiliary Forms (form2, form3 etc), sends exactly which update to the main form?
– user46523
The Forms 2, 3, 4...n will have textbox where the user will put the quantity information, product code, installation position finally, things inherent to the project... When filling in the data in the form2, 3, 4...n the user must click on a button that saves this information and closes the form2, 3, 4...or n...leaving only the Form1 that was in the background (maximized). Form1 has a "generate report" button that exports all data filled in forms2, 3, 4...n to an excel table...
– RicZ
However, in the tests I did, I only managed to generate the table in excel with the data, if by clicking on the save buttons of forms2, 3, 4...n I open the Form1 again (which was already open...in the background)...otherwise I can not transfer the data of the forms2 textbox, 3, 4...n for some vector, memory etc......
– RicZ
It seems that the update only occurs at the time the form is executed (open)...
– RicZ
put the opening code of an item and what on Form1 needs to stay with the values of the other Forms!
– user46523
Actually your question is a bit confusing, but apparently the only way you can keep the data and use it in different Forms would be by using a database. Att. Flávio.
– Flávio Naves Jr
Possible duplicate of Pass information between C Beams#
– Jéf Bueno
Hello, you can create global variables. So a variable created in form 1 can be changed from other forms.
– Miguel Vila