Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to Access to Other form when it's still in "Show()"?

how to Access to Other form when it's still in "Show()"?

Scheduled Pinned Locked Moved C#
tutorialquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    combo_ci
    wrote on last edited by
    #1

    hi my project have 2 form and i call show() method to showing Form2 i want to pass a parameter (or property) to form2 when it showing or find that form2 is close or show in form1:confused: Does anyone know how i can do this action? Thanks;

    J R C 3 Replies Last reply
    0
    • C combo_ci

      hi my project have 2 form and i call show() method to showing Form2 i want to pass a parameter (or property) to form2 when it showing or find that form2 is close or show in form1:confused: Does anyone know how i can do this action? Thanks;

      J Offline
      J Offline
      Justin Perez
      wrote on last edited by
      #2

      I think I understand your question, try using ShowDialog() instead of Show(). If I don't understand your question, reply with more details.

      I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")

      1 Reply Last reply
      0
      • C combo_ci

        hi my project have 2 form and i call show() method to showing Form2 i want to pass a parameter (or property) to form2 when it showing or find that form2 is close or show in form1:confused: Does anyone know how i can do this action? Thanks;

        R Offline
        R Offline
        Ravi Bhavnani
        wrote on last edited by
        #3

        Declare private fields for the properties in Form2 and set them when you construct the form. For example:

        Form2 f2 = new Form2 (prop1, prop2, etc.)
        f2.Show();

        /ravi

        This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com

        1 Reply Last reply
        0
        • C combo_ci

          hi my project have 2 form and i call show() method to showing Form2 i want to pass a parameter (or property) to form2 when it showing or find that form2 is close or show in form1:confused: Does anyone know how i can do this action? Thanks;

          C Offline
          C Offline
          combo_ci
          wrote on last edited by
          #4

          hi my project have 2 forms ...in form 1 i have a button and button1_Click is private void button1_Click(object sender, EventArgs e) { this.DesktopLocation = new Point(DesktopLocation.X - 200, DesktopLocation.Y); new Form2(this.DesktopLocation.X + this.Width, this.DesktopLocation.Y).Show(); } now form2 is Show() and i want to know IN FORM1 that form2 is close or still running .... and when form2 is close event or property fire in form1 to Form1.DesktopLocation return to orginl location... here is source code of my project[] Does anyone know how i can do this action? Thanks;

          L 1 Reply Last reply
          0
          • C combo_ci

            hi my project have 2 forms ...in form 1 i have a button and button1_Click is private void button1_Click(object sender, EventArgs e) { this.DesktopLocation = new Point(DesktopLocation.X - 200, DesktopLocation.Y); new Form2(this.DesktopLocation.X + this.Width, this.DesktopLocation.Y).Show(); } now form2 is Show() and i want to know IN FORM1 that form2 is close or still running .... and when form2 is close event or property fire in form1 to Form1.DesktopLocation return to orginl location... here is source code of my project[] Does anyone know how i can do this action? Thanks;

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Hi Declare in form1 public static bool IsForm2Closed; now in form2 add at closing event this line form1.IsForm2Closed = true; thus , you can query about the var IsForm2Closed from form1 Timer , button or such bye

            I know nothing , I know nothing

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups