I'm a little bit lost right now among objects and references. I'm building a small project with some different classes and winForms.
This is a short description of my project: I have a MainForm and when i click 'add new movie' button, the MovieForm opens where I enter information about a movie. When I click the 'save' button I create a NewMovie object of the information in MovieForm.
Next step is to save this NewMovie object to a file. And it's here I'm a bit lost in how to grab the data from this NewMovie object somewhere else from another class, like the MovieManager from where I then use an object of the FileManager to save the data?
In the MainForm I have this code to detect when the button 'add new movie' is clicked in the MovieForm:
MovieForm movieForm = new MovieForm();
if (movieForm.ShowDialog() == DialogResult.OK)
{
Do something here?
}
Could I reach or pass the new MovieForm object here? How do I do then? In my project I also have a MovieManager. One way is to pass the object to that class? Should I create an object of MovieManager in MovieForm and pass the data that way after I have created the NewMovie object?
Preciate some help and ideas! Thanks!