Hi there. I've got a bunch of classes, they look like this:
(Arrow means the left one got the right one as an object)
MainForm -> ContactForm -> Contact -> Adress + Phone + Email MainForm -> CustomerManager (has a lsit of..) Customer -> Contact -> Adress + Phone + Email
MainForm is the Form that has a list of all Customers. ContactForm is the Form where you enter information about a customer. CustomerManager has a list of Customers.
Now, I need to have MainForm add things to the list; simple List<T>.Add. But the add method needs to be called by something in ContactForm in order to have it added to the list. It's a school assignment, so I can't create or remove classes or their objects. ContactForm cannot call MainForm since it's MainForm's object. I tried making a bool in MainForm that changed when ContactForm exited, but that didn't work.
How would I go about? I don't think I can post all of the classes here, but tell me which one's missing and I'll post it up.

Here's my MainForm:
using System;
using System.Drawing;
using System.Windows.Forms;

namespace assignment_5
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
private CustomerManager m_manager;
private CustomerManager m_copyManager;
private ContactForm m_contact;
private int id = 0;

public MainForm()
{
InitializeComponent();
m_manager = new CustomerManager();
m_copyManager = new CustomerManager(m_manager);
}

private bool CheckInput(int index)
{
if (index > 0 && index < m_manager.CustomerListCount)
return true;
else
return false;
}

public void NewListItem()
{
id++;
string customerString = id + m_contact.FinalString;
customerList.Items.Add(customerString);
}

void AddBtnClick(object sender, EventArgs e)
{
m_contact = new ContactForm();
m_contact.ShowDialog();
}
}
}

And here's my ContactForm, which is an object of MainForm.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using assignment_5.ContactFiles;

namespace assignment_5
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class ContactForm : Form
{
private ContactFiles.Contact m_contact;
private bool instaClose = false;
string stringFinal;

/// <summary>
/// Default constructor.
/// </summary>
public ContactForm()
{
InitializeComponent();
m_contact = new assignment_5.ContactFiles.Contact();
InitializeGUI();
}

/// <summary>
/// Sets-up certain things to make the interface work.
/// </summary>
private void InitializeGUI()
{
FillCountryBox();
countryList.SelectedIndex = 0;
}

#region Properties

/// <summary>
/// Allows access to the m_contact object.
/// </summary>
public Contact ContactData
{
get {return m_contact;}

set
{
if (value != null)
m_contact = value;
}
}

public bool InstantClose
{
get {return instaClose;}
}

#endregion

public string FinalString
{
get {return stringFinal;}
}

private void FillCountryBox()
{
string[] listing = m_contact.AdressData.GetCountryArray();

for (int count = 0; count < listing.Length; count++)
{
countryList.Items.Add(listing[count].Replace("_", " "));
}
}

void OkBtnClick(object sender, EventArgs e)
{
//Filling in from the listboxes
m_contact.FirstName = box_firstName.Text;
m_contact.LastName = box_lastName.Text;
m_contact.AdressData.Street = box_street.Text;
m_contact.AdressData.Zipcode = box_zipCode.Text;
m_contact.AdressData.City = box_city.Text;
m_contact.AdressData.Country = countryList.SelectedItem.ToString();
m_contact.EmailData.Personal = box_privateEmail.Text;
m_contact.EmailData.Work = box_workEmail.Text;
m_contact.PhoneData.Home = box_homePhone.Text;
m_contact.PhoneData.Work = box_mobilePhone.Text;
instaClose = true;

FinalStage();
this.Close();
}

private void FinalStage()
{
if (CheckData())
MessageBox.Show(GetFinalString());
else
MessageBox.Show("Please enter information in all the fields.", "Missing information");
}

private bool CheckData()
{
if ((m_contact.CheckData())
&& (m_contact.AdressData.CheckData())
&& (m_contact.EmailData.CheckData())
&& (m_contact.PhoneData.CheckData()))
return true;
else
return false;
}

void CancelBtnClick(object sender, EventArgs e)
{
this.Close();
}

void ContactFormFormClosing(object sender, FormClosingEventArgs e)
{
if (instaClose == false)
{
DialogResult closeResult = MessageBox.Show("If you close, you will lose all data." + Environment.NewLine + "Continue?", "Data Loss Imminent",
MessageBoxButtons.OKCancel);
if (closeResult == DialogResult.OK)
e.Cancel = false;
else
{
e.Cancel = true;
DefaultAllValues();
}
}
}

private void DefaultAllValues()
{
m_contact.DefaultValues();
m_contact.AdressData.DefaultValues();
m_contact.EmailData.DefaultValues();
m_contact.PhoneData.DefaultValues();
}

private string GetFinalString()
{
stringFinal = m_contact.FirstName + ", " + m_contact.LastName + ", " + m_contact.PhoneData.ToString() + m_contact.EmailData.ToString() + m_contact.AdressData.ToString();
return stringFinal;
}

public override string ToString()
{
return string.Format("{0}, {1}", m_contact.FirstName, m_contact.LastName);
}
}
}


To summarize; how do I call a method in MainFrame - public void NewListItem() - from its objects?
I've been given instructions that say I cannot have any other constructor but the default ones (Adress is an exception though)
and that I cannot create or remove classes, plus I have to retain the object order shown above.


Help greatly appreciated! Thanks!