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. DialogBox in C++/CLI

DialogBox in C++/CLI

Scheduled Pinned Locked Moved Managed C++/CLI
tutorialc++question
4 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
    J_E_D_I
    wrote on last edited by
    #1

    Hi, I can't find any decent example on how to create a DialogBox using C++/CLI and on how to deal with the different responses triggered by the diffent buttons being pressed. I've created graphically the DialogBox (form2) which has 2 buttons "A" and "B" but I can't understand how I can pass different values to the main form (form1) when each button is selected. Is it possible to do it without creating a new class. How? Any example code would be highly appreciated.

    M L L 3 Replies Last reply
    0
    • J J_E_D_I

      Hi, I can't find any decent example on how to create a DialogBox using C++/CLI and on how to deal with the different responses triggered by the diffent buttons being pressed. I've created graphically the DialogBox (form2) which has 2 buttons "A" and "B" but I can't understand how I can pass different values to the main form (form1) when each button is selected. Is it possible to do it without creating a new class. How? Any example code would be highly appreciated.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      J_E_D_I wrote:

      I can't understand how I can pass different values to the main form (form1) when each button is selected.

      You can add public properties and/or methods to the form1 class that can be used like any other class properties/methods. You could also use events if a publisher/subscriber scenario is more appropriate. This is basic C++ and not particular to the UI...

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      1 Reply Last reply
      0
      • J J_E_D_I

        Hi, I can't find any decent example on how to create a DialogBox using C++/CLI and on how to deal with the different responses triggered by the diffent buttons being pressed. I've created graphically the DialogBox (form2) which has 2 buttons "A" and "B" but I can't understand how I can pass different values to the main form (form1) when each button is selected. Is it possible to do it without creating a new class. How? Any example code would be highly appreciated.

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        J_E_D_I wrote:

        but I can't understand how I can pass different values to the main form (form1) when each button is selected.

        As Mark points out, these forms are classes so the same thing applies to them as any class. That said from a Design, Principles and Best Practices perspective, it is not advisable to have cohesion between UI views. See the Design Pattern Model View Controller[^].

        1 Reply Last reply
        0
        • J J_E_D_I

          Hi, I can't find any decent example on how to create a DialogBox using C++/CLI and on how to deal with the different responses triggered by the diffent buttons being pressed. I've created graphically the DialogBox (form2) which has 2 buttons "A" and "B" but I can't understand how I can pass different values to the main form (form1) when each button is selected. Is it possible to do it without creating a new class. How? Any example code would be highly appreciated.

          L Offline
          L Offline
          Luc 648011
          wrote on last edited by
          #4

          Set some Button.DialogResult value for those buttons that should close the dialog and return something. :)

          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