Click here to Skip to main content
15,446,510 members

Comments by Member 3681443 (Top 2 by date)

Member 3681443 13-Oct-10 5:48am View     CRLF
Thanks for the advice Dave but I still am having issues. Let me go back a step and outline in some more detail :- So my Main Form is frmMain (FORM1) and it consists of a few panels. The left hand panel is a series of buttons making up a menu and the right hand side is where the content is placed. An example of what I am doing is i have another form which I place inside the panel control giving the look and feel of a website with a menu on the left, titla bar at the top and content below. This second form ("FORM2" inside the panel) had an option to show a new form (FORM3 showdialog) and when I hit a button on that form, I want to close the form (FORM3) and add another form to the main forms content panel (FORM1) effectively replacing FORM2 with another form. The form FORM3 (showdialog form) does not know about the main form and hence cant add another form to its content panel. By creating a "Global" instance of the frmMain (FORM1) I can then access a method on the form from FORM3 to add to the panel. clsGlobalVariables.GlobalMainForm.panelMain.Controls.Clear(); frmReturningMember formReturningMember = new frmReturningMember(); formReturningMember.TopLevel = false; formReturningMember.Dock = DockStyle.Fill; formReturningMember.FormBorderStyle = FormBorderStyle.None; clsGlobalVariables.GlobalMainForm.panelMain.Controls.Add(formReturningMember); formReturningMember.Show(); This is what I am trying to achieve. Maybe there is a much better way to do this. I did try adding the following code to the Load Event of the frmMain but it steill didnt work :- this.tmrClock.Enabled = true; this.tmrClock.Interval = 1000; this.tmrClock.Tick += new System.EventHandler(this.tmrClock_Tick); The Tick event still is never reached. Thanks, Daniel.
Member 3681443 13-Oct-10 4:54am View     CRLF
I created the time by dragging it onto the Form and setting its Enabled state to true. Like I said when the form was a standard form it worked perfectly so i assume Im missing the fundamental understanding of the "global" instance of the form.