© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
194 replies
Whiteboy

Enable button from another Form [Answered]

there is
-Main menu
then 3 subforms to main menu
-A, B, C

I want to enable Main Menu button when i click a button in form A or B or C

and the code that moves user through forms

        private void OpenChildForm(Form childForm, object btnSender)
        {
            if (btnSender is null)
            {
                throw new ArgumentNullException(nameof(btnSender));
            }

            _activeForm?.Close();

            _activeForm = childForm;
            childForm.TopLevel = false;
            childForm.FormBorderStyle = FormBorderStyle.None;
            childForm.Dock = DockStyle.Fill;
            this.panelDesktop.Controls.Add(childForm);
            this.panelDesktop.Tag = childForm;
            childForm.BringToFront();
            childForm.Show();
        }
        private void OpenChildForm(Form childForm, object btnSender)
        {
            if (btnSender is null)
            {
                throw new ArgumentNullException(nameof(btnSender));
            }

            _activeForm?.Close();

            _activeForm = childForm;
            childForm.TopLevel = false;
            childForm.FormBorderStyle = FormBorderStyle.None;
            childForm.Dock = DockStyle.Fill;
            this.panelDesktop.Controls.Add(childForm);
            this.panelDesktop.Tag = childForm;
            childForm.BringToFront();
            childForm.Show();
        }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

❔ Access button from another script
C#CC# / help
3y ago
Acces data from another form
C#CC# / help
2y ago