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

  • Home
  • SEARCH
  • 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 3663516
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:32:20+00:00 2026-05-19T01:32:20+00:00

I currently have a parent control (Form1) and a child control (Form2). Form1 contains

  • 0

I currently have a parent control (Form1) and a child control (Form2).

Form1 contains a listview that stores a list of of file data (each file is a separate item).

Form2 contains only a textbox.

Upon clicking on one of these listviewitems in Form1, Form2 is opened up and accesses the file’s data and loads it into the textbox in Form2 in plain text format.

The issue I’m having is, I would like to be able to detect, upon clicking of a listviewitem, whether that file is already opened in said child form and if so, to activate it (bring it to the front) and if it is not already opened, open it. I’m not sure what the best method of doing this would be since this can involve many child forms being open at once. This is not an MDI application. Any ideas on how this could be accomplished are appreciated and samples even more so. Thank you.

  • 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-19T01:32:21+00:00Added an answer on May 19, 2026 at 1:32 am

    What I have done in the past is give each new form a unique tag (based on the file you’re viewing in this case), so:

    var form = new Form2();
    form.Tag = (object)"My Unique Object as a Tag"; // Redundant cast I know, but shows Tag is of type object
    

    Then, when going to open up a window for a file, iterate over all the open forms checking tags like so:

    foreach(var f in Application.OpenForms)
    {
       if(f.Tag == tagForFile)
       {
           f.BringToFront();
           return;
       }
    }
    // Couldn't find one, so open on
    var form = new Form2();
    form.Tag = tagForFile;
    form.Show();
    

    And this should only open up one form per file (or tag really)

    Hopefully that helps !

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

Sidebar

Related Questions

I have a parent form, which contains panels that calls different user control. For
I have an sql statement that currently is just returning all the end parent
I have a parent contentcontrol which displays data via a datatemplate. The datatemplate contains
I have a child form that I load from a parent form. The parent
I am currently using an asp.net menu control to load from a table parent/child
Currently, I have a Maven project which inherits from a parent pom defining two
I currently have an MS Access application that connects to a PostgreSQL database via
I have a control in my parent mdi form which I wish to be
I am currently working on a project where we have a couple very control
I'm facing the following problems: We have meta data for items, each item can

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.