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. What is the difference between "Show() "and "ShowDialog()"?

What is the difference between "Show() "and "ShowDialog()"?

Scheduled Pinned Locked Moved C#
question
6 Posts 3 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.
  • F Offline
    F Offline
    fengyuchun88
    wrote on last edited by
    #1

    private delegate void TestHandler();
    private TestHandler mTestDelegate;

    public fmMain()
    {
    InitializeComponent();
    }

    private void fmMain_Load(object sender, EventArgs e)
    {
    mTestDelegate = new TestHandler(() =>
    {
    Form fmTest = new Form();
    fmTest.ShowDialog();//don't write "Show()"
    });
    mTestDelegate.BeginInvoke(null, null);
    }

    Why can not I Wrtie "fmTest.Show()"

    OriginalGriffO G 3 Replies Last reply
    0
    • F fengyuchun88

      private delegate void TestHandler();
      private TestHandler mTestDelegate;

      public fmMain()
      {
      InitializeComponent();
      }

      private void fmMain_Load(object sender, EventArgs e)
      {
      mTestDelegate = new TestHandler(() =>
      {
      Form fmTest = new Form();
      fmTest.ShowDialog();//don't write "Show()"
      });
      mTestDelegate.BeginInvoke(null, null);
      }

      Why can not I Wrtie "fmTest.Show()"

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Please do not post the same thing in multiple places - it wastes time and can annoy people.

      The only instant messaging I do involves my middle finger.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      F 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Please do not post the same thing in multiple places - it wastes time and can annoy people.

        The only instant messaging I do involves my middle finger.

        F Offline
        F Offline
        fengyuchun88
        wrote on last edited by
        #3

        i am very sorry to do that.

        1 Reply Last reply
        0
        • F fengyuchun88

          private delegate void TestHandler();
          private TestHandler mTestDelegate;

          public fmMain()
          {
          InitializeComponent();
          }

          private void fmMain_Load(object sender, EventArgs e)
          {
          mTestDelegate = new TestHandler(() =>
          {
          Form fmTest = new Form();
          fmTest.ShowDialog();//don't write "Show()"
          });
          mTestDelegate.BeginInvoke(null, null);
          }

          Why can not I Wrtie "fmTest.Show()"

          G Offline
          G Offline
          Glen Childs
          wrote on last edited by
          #4

          .Show will show the form you want to display and will allow you to go back to the other window without closing it, and .ShowDialog will show the form you want to display and wont allow you to go back to the other window with out closing the new window.

          1 Reply Last reply
          0
          • F fengyuchun88

            private delegate void TestHandler();
            private TestHandler mTestDelegate;

            public fmMain()
            {
            InitializeComponent();
            }

            private void fmMain_Load(object sender, EventArgs e)
            {
            mTestDelegate = new TestHandler(() =>
            {
            Form fmTest = new Form();
            fmTest.ShowDialog();//don't write "Show()"
            });
            mTestDelegate.BeginInvoke(null, null);
            }

            Why can not I Wrtie "fmTest.Show()"

            G Offline
            G Offline
            Glen Childs
            wrote on last edited by
            #5

            I think you wont be able to do: fmTest.Show(); as "fmTest" is the main/only form. Can someone correct me if im wrong.

            F 1 Reply Last reply
            0
            • G Glen Childs

              I think you wont be able to do: fmTest.Show(); as "fmTest" is the main/only form. Can someone correct me if im wrong.

              F Offline
              F Offline
              fengyuchun88
              wrote on last edited by
              #6

              i want to know why I wrote "fmTest.Show()", the form("fmTest") will not be responded?? i hopt you copy my code and run it ,you will understand it Thank you!

              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