Adding a new “Book” object created in Form2 to List created by an “Import” object in Form1
I am new to Windows Forms and my assignment is to create a program that upon launch, populates a list of books from a txt file and then allow the user to click a button and display a random book as a suggestion of what to read. This is all working as intended.
My problem is that I want to be able to click a button, open a 2nd form which then allows the user to add a new book to both the List and the txt file. I have successfully made the new Book object add to the txt file and upon closing and relaunching the program, the new book shows up when I display random books but I am having trouble adding it to List books. The list has to be created by an object of the class “Import” but I cant figure out how to pass import into Form2 to be able to access the List when adding the new Book.
Child Class Object using (or attempting to use) Parent Class Object function instead of its own
To get straight to the point, on a WinForms project, I have the following classes (All in the same namespace):
C#: Child Class Object using (or attempting to use) Parent Class Object function instead of its own
To get straight to the point, on a WinForms project, I have the fallowing classes (All in the same namespace):