Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 833455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:31:15+00:00 2026-05-15T04:31:15+00:00

How to Bring (form_x) to the front. I have a custom usercontrol which opens

  • 0

How to Bring (form_x) to the front.
I have a custom usercontrol which opens (form_x) and I use this usercontrol for all of my forms. and now the problem is that the usercontrol opens a new (form_x) instead of Bringing of(form_x) to the front.

my control

namespace template
{
    public partial class Background : UserControl
    {

        IniFile ini = new IniFile(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"\config.ini");

        public Background()
        {
            InitializeComponent();
            //Console.WriteLine(FilterNumbers("1.0.0.0. beta"));
            //Console.WriteLine(FormatFileSize(125463));
        }

        private void lbl_About_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
                       frm_about formOptions = new frm_about();
        bool isFormOpen = false;
        foreach (Form frm in Application.OpenForms)
        {
            if (frm is frm_about)
            {
                frm.BringToFront();
                isFormOpen = true;
                break;
            }
        }
        if (!isFormOpen)
            formOptions.Show();
        else
            formOptions.Dispose();
        }

        private void ThisRefresh()
        {
            this.lbl_About.Visible = _About;
            this.lbl_About.Enabled = _AboutE;
        }

        private bool _AboutE;
        public bool AboutE
        {
            get { return _AboutE; }
            set { _AboutE = value; ThisRefresh(); }
        }



        public static string FilterNumbers(string mightContainNumbers)
        {
            if (mightContainNumbers == null || mightContainNumbers.Length == 0) return "";

            StringBuilder builder = new StringBuilder(mightContainNumbers.Length);
            foreach (char c in mightContainNumbers)
                if (Char.IsNumber(c))
                    builder.Append(c);

            return builder.ToString();
        }
        public static string FormatFileSize(long fileSize)
        {
            if (fileSize < 0) throw new ArgumentOutOfRangeException("fileSize");

            if (fileSize >= 1024 * 1024 * 1024) return string.Format("{0:########0.00} GB", ((double)fileSize) / (1024 * 1024 * 1024));
            else if (fileSize >= 1024 * 1024) return string.Format("{0:####0.00} MB", ((double)fileSize) / (1024 * 1024));
            else if (fileSize >= 1024) return string.Format("{0:####0.00} KB", ((double)fileSize) / 1024);
            else return string.Format("{0} bytes", fileSize);
        }
    }
}

//

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:31:15+00:00Added an answer on May 15, 2026 at 4:31 am

    I think you’re problem is here:

    frm_about formOptions = new frm_about();
    bool isFormOpen = false;
    foreach (Form frm in Application.OpenForms)
    {
        if (frm is frm_about)
        {
            frm.BringToFront();
            isFormOpen = true;
            break;
        }
    }
    

    You’re creating a new instance of frm_about and then checking to see if it’s on the list of the Applications open forms. It won’t be.

    This will mean that isFormOpen will always be false.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that sends emails to customers. It has a send all
Can anyone help? I have a PHP method that sends an http post: <?php
On a blank winform code can be added to show lines that intersect (crosshairs)
So I am trying to log into my site using an NSMutableURLRequest which presents
I'm working on a script that will submit form files (images) through a temporary
Here's the HTML part that may be wrong perhaps on the form statement (not
I'm interested in creating an action for the admin interface that requires some additional
I am setting the BackgroundImage of a Windows Form to a 200 x 200
How can I add a string to my visual basic form? I'm creating a
It seems like every unit test example I've encountered is incredibly obvious and canned.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.