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 check if form was activated

how to check if form was activated

Scheduled Pinned Locked Moved C#
questiontutorial
6 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.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    i have an MDI child (MDI1) form which I am opening another MDI child (MDI2) from that form. How can I check if MDI1 was ctivated after closing MDI to refresh it? do I have to use Enter or Activated events?

    A C 2 Replies Last reply
    0
    • J Jassim Rahma

      i have an MDI child (MDI1) form which I am opening another MDI child (MDI2) from that form. How can I check if MDI1 was ctivated after closing MDI to refresh it? do I have to use Enter or Activated events?

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      use this.ActiveMdiChild It will return the MDI child form that is currently active. If you want to activate another form just use frm2.focus(); :rose:

      Abhishek Sur


      My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

      **Don't forget to click "Good Answer" if you like to.

      J 1 Reply Last reply
      0
      • A Abhishek Sur

        use this.ActiveMdiChild It will return the MDI child form that is currently active. If you want to activate another form just use frm2.focus(); :rose:

        Abhishek Sur


        My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

        **Don't forget to click "Good Answer" if you like to.

        J Offline
        J Offline
        Jassim Rahma
        wrote on last edited by
        #3

        I don't want to focus it. well, let me explain it more.. MDI2 is an edit form of MDI1 so MDI is just viewing the data where MDI2 is the edit. when the user clicks on the edit button (on MDI1) it will open MDI2. when the user click save (on MDI2) it will close MDI2.. now I want to know if any data were changed and refresh the data on MDI accordainaly.

        A M 2 Replies Last reply
        0
        • J Jassim Rahma

          I don't want to focus it. well, let me explain it more.. MDI2 is an edit form of MDI1 so MDI is just viewing the data where MDI2 is the edit. when the user clicks on the edit button (on MDI1) it will open MDI2. when the user click save (on MDI2) it will close MDI2.. now I want to know if any data were changed and refresh the data on MDI accordainaly.

          A Offline
          A Offline
          Abhishek Sur
          wrote on last edited by
          #4

          Well, Do the refresh of data when form is activated. Write the code inside Form_Activated to refresh the form with new data. Dont forget to set a flag when edit is done and recheck the flag within form_Activated. Otherwise the data will be refreshed every time you activate the form.:cool:

          Abhishek Sur


          My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

          **Don't forget to click "Good Answer" if you like to.

          1 Reply Last reply
          0
          • J Jassim Rahma

            I don't want to focus it. well, let me explain it more.. MDI2 is an edit form of MDI1 so MDI is just viewing the data where MDI2 is the edit. when the user clicks on the edit button (on MDI1) it will open MDI2. when the user click save (on MDI2) it will close MDI2.. now I want to know if any data were changed and refresh the data on MDI accordainaly.

            M Offline
            M Offline
            MickCurley
            wrote on last edited by
            #5

            Create a bool on MDI2, set it to true if data is edited. Create a readonly property for this bool on MDI2 and check it from MDI1. Refresh if true.

            Regards Mick Curley :)

            1 Reply Last reply
            0
            • J Jassim Rahma

              i have an MDI child (MDI1) form which I am opening another MDI child (MDI2) from that form. How can I check if MDI1 was ctivated after closing MDI to refresh it? do I have to use Enter or Activated events?

              C Offline
              C Offline
              carlecomm
              wrote on last edited by
              #6

              of course, you should use these event. for example, use 'closing event ' to check if MDI1 was activted. or you can use WINAPI ('FindWindow')to Find out that 'WinForm', and then check if it was actived.

              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