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. showdialog box

showdialog box

Scheduled Pinned Locked Moved C#
question
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.
  • T Offline
    T Offline
    Tichaona J
    wrote on last edited by
    #1

    Usually as below if you want to check the result of a open file dialog you use the following code: if (fDialog.ShowDialog() == DialogResult.OK) { MessageBox.Show("User clicked on OK / Open"); } However this does not seem to work when developing a Windows Presentation Foundation based application, any suggestions ?

    K 1 Reply Last reply
    0
    • T Tichaona J

      Usually as below if you want to check the result of a open file dialog you use the following code: if (fDialog.ShowDialog() == DialogResult.OK) { MessageBox.Show("User clicked on OK / Open"); } However this does not seem to work when developing a Windows Presentation Foundation based application, any suggestions ?

      K Offline
      K Offline
      kapax5
      wrote on last edited by
      #2

      In WPF you cannot do that because it returns only Nullable<Boolean>. So, a code like this should do the trick:

      fDialog.ShowDialog();

      if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
      {
      MessageBox.Show("User clicked on OK / Open");
      }

      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