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. SaveFileDialog and OverwritePrompt

SaveFileDialog and OverwritePrompt

Scheduled Pinned Locked Moved C#
csharpwinformscomquestionlearning
16 Posts 5 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.
  • G GenJerDan

    jibesh wrote:

    Can you share the code how you invoke the SaveFileDialog

    if (saveProjectDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { SaveProject(saveProjectDialog.FileName); etc. But I just found out it isn't just the SaveFileDialog doing it. Every MessageBox is doing the same. (No, nothing in the project is set to TopMost.) I don't have anywhere to post screen captures at the moment, but the dialogs are different when ShowHelp is used or not. One is a huge Windows 7 Explorer-ish box, the other is a small dialog with the 5 icons down the left side for Recent Places, Desktop, Libraries, Computer, Network.

    YouTube and My Mu[sic], Films and Windows Programs, etc.

    J Offline
    J Offline
    Jibesh
    wrote on last edited by
    #7

    Quote:

    Every MessageBox is doing the same

    so this is nothing to do with the SaveFileDialog. Is just the MessageBox in your application behaves like this or same for the whole PC?

    Jibesh V P

    G 1 Reply Last reply
    0
    • J Jibesh

      Quote:

      Every MessageBox is doing the same

      so this is nothing to do with the SaveFileDialog. Is just the MessageBox in your application behaves like this or same for the whole PC?

      Jibesh V P

      G Offline
      G Offline
      GenJerDan
      wrote on last edited by
      #8

      Just my app. (And on this and my home machine)

      YouTube and My Mu[sic], Films and Windows Programs, etc.

      J 1 Reply Last reply
      0
      • G GenJerDan

        Just my app. (And on this and my home machine)

        YouTube and My Mu[sic], Films and Windows Programs, etc.

        J Offline
        J Offline
        Jibesh
        wrote on last edited by
        #9

        can you provide some more information about your Form where you display the saveFileDialog. how the form is displayed? was it a MDI Child? or a simple winform.

        Jibesh V P

        G 1 Reply Last reply
        0
        • J Jibesh

          can you provide some more information about your Form where you display the saveFileDialog. how the form is displayed? was it a MDI Child? or a simple winform.

          Jibesh V P

          G Offline
          G Offline
          GenJerDan
          wrote on last edited by
          #10

          It's just the main form of a winforms app. The only settings on it that aren't the default are: DoubleBuffered : True StartPosition: CenterScreen

          YouTube and My Mu[sic], Films and Windows Programs, etc.

          J 1 Reply Last reply
          0
          • G GenJerDan

            It's just the main form of a winforms app. The only settings on it that aren't the default are: DoubleBuffered : True StartPosition: CenterScreen

            YouTube and My Mu[sic], Films and Windows Programs, etc.

            J Offline
            J Offline
            Jibesh
            wrote on last edited by
            #11

            that's strange :doh: . hmmm.. lets try all other possibilities then. 1. Clean and Rebuild all your solution 2. create a new sample winformn with one button on it and to call the same method, if it works there something is modified in your code. handled any other events?

            Jibesh V P

            G 1 Reply Last reply
            0
            • J Jibesh

              that's strange :doh: . hmmm.. lets try all other possibilities then. 1. Clean and Rebuild all your solution 2. create a new sample winformn with one button on it and to call the same method, if it works there something is modified in your code. handled any other events?

              Jibesh V P

              G Offline
              G Offline
              GenJerDan
              wrote on last edited by
              #12

              1. Done multiple times 2. other events: Closing (prompts to save files) Load (sets an MRU menu and lcoses the Splash form. Thought it might be the Splash, but taking that out didn't fix it. At this stage, I think I'll just go with a home-built prompt form instead of the MessageBox. At least that I can set to topmost...and it works. (It's also nice to have it look like the rest of the program instead of generic Windows box popping up.)

              YouTube and My Mu[sic], Films and Windows Programs, etc.

              1 Reply Last reply
              0
              • G GenJerDan

                WinForms, of course. Any idea why the overwrite prompt is popping up behind everything, rather than in front of everything where it might be useful? Pushing the Alt key brings it immediately up where it belongs. (As an aside, why are there two different SaveFileDialogs, depending on whether you choose to "ShowHelp"?)

                YouTube and My Mu[sic], Films and Windows Programs, etc.

                B Offline
                B Offline
                BobJanova
                wrote on last edited by
                #13

                This will happen if you're creating the message box in a different thread. Make sure that any event handlers on asynchronous processes (network communication, serial ports, BackgroundWorker, TPL or ThreadPool background tasks, etc) that refer to the UI get BeginInvoke'd. You mentioned a splash screen ... that is often done on a separate thread to the main UI, so check you haven't ended up creating message boxes in that thread.

                G 1 Reply Last reply
                0
                • B BobJanova

                  This will happen if you're creating the message box in a different thread. Make sure that any event handlers on asynchronous processes (network communication, serial ports, BackgroundWorker, TPL or ThreadPool background tasks, etc) that refer to the UI get BeginInvoke'd. You mentioned a splash screen ... that is often done on a separate thread to the main UI, so check you haven't ended up creating message boxes in that thread.

                  G Offline
                  G Offline
                  GenJerDan
                  wrote on last edited by
                  #14

                  No threading in the app. Not even the Splash. No "weird" things involved except creating some bits and pieces on the fly. I even tried setting the owner on the dialog, hoping it would pass it along and fix the problem, but to no avail. Another odd thing the app does: when starting, it will appear on the screen wherever the mouse cursor happens to be, i.e. start it on monitor 1, then move the mouse over to monitor 2 to do something else and it will show up over there on monitor 2. (Extended display, dual monitors) Programming is SO much fun. :p

                  YouTube and My Mu[sic], Films and Windows Programs, etc.

                  1 Reply Last reply
                  0
                  • G GenJerDan

                    WinForms, of course. Any idea why the overwrite prompt is popping up behind everything, rather than in front of everything where it might be useful? Pushing the Alt key brings it immediately up where it belongs. (As an aside, why are there two different SaveFileDialogs, depending on whether you choose to "ShowHelp"?)

                    YouTube and My Mu[sic], Films and Windows Programs, etc.

                    M Offline
                    M Offline
                    micke andersson
                    wrote on last edited by
                    #15

                    It might not be your code, It might be this: Windows 7, new windows opening behind other windows[^]

                    G 1 Reply Last reply
                    0
                    • M micke andersson

                      It might not be your code, It might be this: Windows 7, new windows opening behind other windows[^]

                      G Offline
                      G Offline
                      GenJerDan
                      wrote on last edited by
                      #16

                      Hmmm... ForegroundFlashCount was set to 7. We'll see. Thanks.

                      YouTube and My Mu[sic], Films and Windows Programs, etc.

                      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