Hey,
after getting some help recently i have a form with a flowlayoutpanel that has dynamically generated controls. Each of these controls has a collection of items (Appointments within a Calendar).
What i am trying to do is have the system add an item to the items collection (Either manually or through the Public Void CreateItemOnSelection function) but am having some difficulty in assigning that as either part of the code from the menustip selection or as the mouse down event... i seem unable to reference the calendar that has been generated dynamically. I see that there is a sender argument which i thought would have been a reference to the control that the right click menu was selected on allowing me to do e.CreateItemOnSelected however that does not seem to work.
This is how i have the calendars auto generated at this point and the snipets from the menu strip selection and the dynamically assigned event(I hope my question makes sense).
after getting some help recently i have a form with a flowlayoutpanel that has dynamically generated controls. Each of these controls has a collection of items (Appointments within a Calendar).
What i am trying to do is have the system add an item to the items collection (Either manually or through the Public Void CreateItemOnSelection function) but am having some difficulty in assigning that as either part of the code from the menustip selection or as the mouse down event... i seem unable to reference the calendar that has been generated dynamically. I see that there is a sender argument which i thought would have been a reference to the control that the right click menu was selected on allowing me to do e.CreateItemOnSelected however that does not seem to work.
This is how i have the calendars auto generated at this point and the snipets from the menu strip selection and the dynamically assigned event(I hope my question makes sense).
C#:
public void AddCalendar()
{
numCals = numCals + 1;
Calendar MyCal = new Calendar();
MyCal.Name = "Calendar" + numCals.ToString();
MyCal.Height = this.flowLayoutPanel1.Height - 5;
MyCal.ContextMenuStrip = CalendarMenuStrip;
MyCal.DoubleClick += cal_DoubleClick;
MyCal.Font = new Font("Arial", 8, FontStyle.Regular);
this.flowLayoutPanel1.Controls.Add(MyCal);
ResizeCals();
}
private void cal_DoubleClick(Object sender, EventArgs e)
{
frmDetails appointment = new frmDetails();
appointment.Show();
appointment.TopMost = true;
}
private void setPatientDataToolStripMenuItem_Click(object sender, EventArgs e)
{
frmDetails Details = new frmDetails();
Details.Show();
Details.SetPatDetails(patfirst, patphone, patMedicalID, patcomments);
}