15,885,757 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 3681443 (Top 2 by date)
Member 3681443
13-Oct-10 5:48am
View
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
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.