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. Managed C++/CLI
  4. Dialogs in Windows Forms application

Dialogs in Windows Forms application

Scheduled Pinned Locked Moved Managed C++/CLI
tutorialwinformsjsonhelpquestion
2 Posts 2 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.
  • K Offline
    K Offline
    krajnik
    wrote on last edited by
    #1

    I am having trouble with a Forms application I'm writing. I have 3 forms: a main form, Form1, and two modal dialogs, Forms 2 and 3, that are called from the main form. The two dialogs are intended to change certain "control parameters" that are used by the main form to run a control algorithms. So I need the two dialogs to be able to set certain variables that are used by the rest of hte program. Also, when I open one of hte dialogs, the controls on that from should reflect the current state of those variables. I cannot figure out how to do this. I thought I could declare global variables that could be accessed by all three forms. That way, when I open a dialog, its controls would be set based on the current values of those globals. Then, when I close the dialog and apply the changes, those changes would be saved back to the global variables. I tried this, and I can't seem to define variables that are accessible to all the dialogs. Am I going about this all wrong? Can anyone help guide me in the right direction? ANy help would be greatly appreciated. Andrew Krajnik

    S 1 Reply Last reply
    0
    • K krajnik

      I am having trouble with a Forms application I'm writing. I have 3 forms: a main form, Form1, and two modal dialogs, Forms 2 and 3, that are called from the main form. The two dialogs are intended to change certain "control parameters" that are used by the main form to run a control algorithms. So I need the two dialogs to be able to set certain variables that are used by the rest of hte program. Also, when I open one of hte dialogs, the controls on that from should reflect the current state of those variables. I cannot figure out how to do this. I thought I could declare global variables that could be accessed by all three forms. That way, when I open a dialog, its controls would be set based on the current values of those globals. Then, when I close the dialog and apply the changes, those changes would be saved back to the global variables. I tried this, and I can't seem to define variables that are accessible to all the dialogs. Am I going about this all wrong? Can anyone help guide me in the right direction? ANy help would be greatly appreciated. Andrew Krajnik

      S Offline
      S Offline
      Signal 9
      wrote on last edited by
      #2

      I cant remember if windows forms has the OnInitDialog(), if so override that and for the closing of the dialog you can override OnClose(). when you overwrite onclose make sure you call DestroyWindow() from the parent class.

      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