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. Visual Basic
  4. MDI QueryUnloads

MDI QueryUnloads

Scheduled Pinned Locked Moved Visual Basic
htmldatabasecomdebugginghelp
6 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.
  • J Offline
    J Offline
    Jason McBurney
    wrote on last edited by
    #1

    Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .

    T C R N 4 Replies Last reply
    0
    • J Jason McBurney

      Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .

      T Offline
      T Offline
      Tom Welch
      wrote on last edited by
      #2

      Ouch! This really belongs in the VB forum. Please post it over there with all of the code from your QueryUnload proc. -- I hate to pull the WRONG BOARD thing, but hey its for the cause.

      1 Reply Last reply
      0
      • J Jason McBurney

        Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .

        C Offline
        C Offline
        Colin Leitner
        wrote on last edited by
        #3

        Check at at wich kind of UnloadMode you wan't to prompt the user and only then set cancel to one '1'. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd If CheckSave()) Then cancel = 1 '<<< end sub Should do

        1 Reply Last reply
        0
        • J Jason McBurney

          Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .

          R Offline
          R Offline
          Roger Wright
          wrote on last edited by
          #4

          The regulars must be asleep, else at least your hair would be badly singed by now!:laugh: "Knock, knock." "Who's there?" "Recursion." "Recursion who?" "Knock, knock..."

          1 Reply Last reply
          0
          • J Jason McBurney

            Okay, I have an mdi application that I want to close (by pressing the go away button) it has one child form open, which contains dirty data. Due to the nature of "WetWare" (users) issues I display a dialog that says "You have dirty data did you really mean to save it, or would you like to abandon your changes?" This is done in the queryUnload of the mdi child. If the user choose to saves we get stuck in an infinate queryunload event loop. Private Sub Form_QueryUnload(cancel As Integer, _ UnloadMode As Integer) writelog "Query Unload" Debug.Print "hwnd:= " & Me.hwnd cancel = Not (CheckSave()) end sub Private Function CheckSave() As Boolean ''False I was unable to save something, ''or the user canceled ''true life is good. I am successful and or compleate if not dirty then ... New form ... show form ... unload form ... set form = nothing end if end function Am I missing something or should this work? What kind of restrictions is there in the queryUnload event. None of the ms documentation mentioned that form creation is a bad idea :-) Any sugesstions would be appricated .

            N Offline
            N Offline
            Nick Parker
            wrote on last edited by
            #5

            Hey Roger, I'm awake, but he has already been warned to move his question. :) Did you find you answer Jason? Nick Parker


            J 1 Reply Last reply
            0
            • N Nick Parker

              Hey Roger, I'm awake, but he has already been warned to move his question. :) Did you find you answer Jason? Nick Parker


              J Offline
              J Offline
              Jason McBurney
              wrote on last edited by
              #6

              Sorry, I didn't post sooner .... I could not find my message :) I was not aware there was a vb section. I tried the different code: ...If CheckSave() Then Cancel = 1 But no, that has the exact same effect as the original code :(( it seems like the community thinks this should be an okay use of a form and a dialog, so I must be creating a referance or something that is messing me up... I am still looking into it Thanks for your time, All.

              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