Hi All,
In my UserControlProject, in which just contains MenuStrips Controls, I have two properties, one is SourceForm, and another one is DestinationForm:
private Form SourceForm = new Form();
public Form _SourceForm
{
get { return SourceForm; }
set { SourceForm = value; }
}
private Form DestinationForm = new Form();
public Form _DestinationForm
{
get { return DestinationForm; }
set { DestinationForm = value; }
}
Now once I clicked the one of the MenuItems, which is dragged and dropped in WindowsFormApplication, in the MenuStrip as the code show below, ideally it suppose to navigate to the DestinationForm.
private void tsmiExecuteSql_Click(object sender, EventArgs e)
{
MenuNavigation.ShowForm(SourceForm, DestinationForm);
}
Now my issue was i can only set the SourceForm and DestinationForm in WindowsFormProject's Form_Load Event like this:
private void frm1_Load(object sender, EventArgs e)
{
ucMenuStrip._SourceForm = this;
ucMenuStrip._DestinationForm = new frm2();
}
and the MenuItems only execute the Form_Load event on the destination form, not the source form, hence there is no way for me to re-set the DestinationForm property, and to make things even worse, the event on the UserControlProject does not have the access to the Forms in the WindowsFormProject, therefore, i can not specifiy the SourceForm and DestinationForm in the UserControlProject's MenuStripItem click events either.
To cut the thread short, really what i would like to know is how to re-set the UserControlProject's SourceForm and DestinationForm once MenuStripItems clicked on WindowsFormProject?