Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Stop Form From Dragging Off-Screen


I've searched this quite a bit and keep coming up with the same results... all of which don't really solve the problem...

I have a form that I want users to drag, however, I do not want the form to cross the edges of the screen. That is, I do not want any part of the form to disappear outside the screen. The only code I've found close to this is one to snap the form to the edge of the screen (while still allowing it to be pushed outside the screen).

I've tried using the mouse position API for the form, but it doesn't capture the X and Y coordinates for when you're over the form's border. I understand this to only see the INSIDE of the form, and not the form's border included.

Thanks in advance!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Stop The Dragging...?
Here's what I have:
- A label control array within a picturebox. The label control array
- can be dragged left and right from one end of the picturebox
- to the other. The problem is that the control array can also
- be dragged past either end of the picturebox, making the label
- control array not usable.

Here's what I need:
- To be able to have the label control array stop from being
- dragged. In other words, have a left and right limit as to how
- far the control array can be dragged.

The way I'm doing it now.....doesn't work.
Any ideas welcome...

Stop Title Bar Mouse Dragging
Hello Folks,
i am new to this forum but i have a problem which i have researched but failed.
I have disabled my applications titlebar,maximise button. But the title bar actually docks itself in a restored state and yet i wanted it maximised so that no one would drag it over the screen as this happens when its in a restored state.

How can i be able to disable the Mouse Click move titlebar(or application window) action.
Thanks in advance.

MSFlexGrid - Anyway To Stop Scrolling When Dragging?
Hi...

I've attempted several things to try and prevent the grid display from scrolling when I'm dragging (manual dragmode)..but nothing seems to work. Anyone knows of a way to do this?

Francis

Stop Item Dragging/moving In ListView
Is there any way you can stop the user from moving the item position in a listview?? I need them to stay the same as i added them first by code, with them being fixed for the user and not allowing any movement of item position!

thanks!

Stop Dragging Links From Webbrowser Control
Hi all,
i'm creating a securelink browser application using
WebBrowser cotrol in VB6.
Our requirment is that no one can't do drag and drop
a hyperlink out side the application ,as one can do
with other browsers.
so how can i do this ,plz help me.

Thanks

Stop Full-Screen Web Browser.
I've been fooling around with the MS Internet Controls, mostly the web-browser. I noticed that if you goto a site that causes the browser to go full-screen it will resize itself and cover almost everything in your form. Is there a way to stop this from happening?

Stop Repainting Of Screen Temporarily
I am creating a program in which I have to move images around the screen to test for a condition, then move the images back to where they were to start with (its a chess program...have to see if player is in check before allowing the move).

Is there any way I can turn off the redrawing of the screen/form/images while the pieces are moving and then turn it on again when they're done? Thanks for your help!

Dragging A Form
Hi all,

I have created a form that pops up and follows the curser around the screen when you are dragging an item from one list to another. This works with a timer on the form that repeatedly repositions the form next to the curser using the GetCursorPos function. I have a text box on this form that I want the user to be able to type in whilst dragging an item. If the moue button is not held down (and the form is just following the cursor), the text box accepts text quite happily, but when the mouse is held down as you are dragging an item, te text box does not accept text any more!?
I have tried using the GetKeyState function in the timer loop combined with a loop to go through the ascii key codes, to place letters that are pressed after the existing text in the box, but that doesnt account for the other keys on the keyboard such as the curser keys, delete, backspace, etc.

Does anybody have any suggestions on how I can make the text box accept input while the mouse button is pressed and dragging?

Any help would be great

Thanks in advance, Al.

Dragging The Form
I have a form with no border. Is there a way to drag the form and move it around the screen without having the title bar to click on? thanks

Form Dragging
Ok my form is useing a graphic image over the form but im having a problem dragging the form, I keep getting Compile err0r: Sub or Function not defined.


Code:
Private Sub Label3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Drag Me
End Sub

Help

Dragging A Form
Hi all,

I have created a form that pops up and follows the curser around the screen when you are dragging an item from one list to another. This works with a timer on the form that repeatedly repositions the form next to the curser using the GetCursorPos function. I have a text box on this form that I want the user to be able to type in whilst dragging an item. If the moue button is not held down (and the form is just following the cursor), the text box accepts text quite happily, but when the mouse is held down as you are dragging an item, te text box does not accept text any more!?
I have tried using the GetKeyState function in the timer loop combined with a loop to go through the ascii key codes, to place letters that are pressed after the existing text in the box, but that doesnt account for the other keys on the keyboard such as the curser keys, delete, backspace, etc.

Does anybody have any suggestions on how I can make the text box accept input while the mouse button is pressed and dragging?

Any help would be great

Thanks in advance, Al.

Dragging Out Of My Form
Hi, I'm using drag/drop to remove certain objects from my form. I got most of it working so far.. I can drag an item over a certain object and it removes this object from the form. But i want to be able to drag the item outside the form and have it get removed as well. Any idea's?

Form Dragging
Ok, i have 3 forms, and my form1 is my main form, and what i want is that whenever the main form is dragged and moved around then the 2 other forms will move along with it.

So far i have this, but it will only work when you click on the back of the form, which i dont want as i want it to happen when you click the caption bar thing.


VB Code:
Private Done as Boolean Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button = vbLeftButton Then        Done = True    End IfEnd Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button = vbLeftButton Then        Done = False    End IfEnd Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)'Snapping    If Done = True Then        If frmMulti.SnapPlaylist.Value = 1 Then            frmPlaylist.Top = Me.Top            frmPlaylist.Left = Me.Left + Me.Width        End If        If frmMulti.SnapExtra.Value = 1 Then            frmMulti.Left = Me.Left            frmMulti.Top = Me.Top + Me.Height        End If    End IfEnd Sub

Dragging The Form
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long


Code:
Private Declare Function ReleaseCapture Lib "user32" () As Long



Code:
Private Const WM_MOVE = &HF012


Code:
Private Const WM_SYSCOMMAND = &H112



Code:
Sub MoveTheForm(NameOfForm As Form)


Code:
Call ReleaseCapture


Code:
Call SendMessage(NameOfForm.hwnd, WM_SYSCOMMAND, WM_MOVE, 0)


Code:
End Sub


I'm trying to make it so the user can drag the form when he clicks anywhere on the form. However, the code is not working!! I'm using the above declerations and then calling it like this:

Private Sub Form_Click()
Call MoveTheForm(Form1)
End Sub

however, this is not doing anything!! What's wrong??

Dragging The Form
is there a message or something the program receives while the window is being dragged across the screen?

i want to be able to make another form 'stick' to the bottom of this form, but i don't know how to find out if the form is being dragged.

Stop Minimize From Full Screen From Closing
I play Final Fantasy XI and when you go into the game it is full screen like most games. Thing is when I try to tab out of the game it says something about full screen lost an the game closes.

I would like to figure out how to go about stopping the game from closing. I have seen a few third party applications out there that can do this but I am not really a fan of third party applications unless they are my own.

Does anyone have any idea what I would have to do to stop it from closing when I do this?

Detect And Stop Mouse Click Anywhere On Screen?
I'm currently using this code to detect a mouse click any where on screen and retrieve the pixel color underneath:

Code:
Dim tPOS As POINTAPI
Dim sTmp As String
Dim lColor As Long
Dim lDC As Long
lDC = GetWindowDC(0)
Call GetCursorPos(tPOS)
lColor = GetPixel(lDC, tPOS.X, tPOS.Y)
' sTmp = Right$("000000" & Hex(lColor), 6)
inputtext.Text = lColor
tester = GetAsyncKeyState(vbKeyEscape)
If tester And &H8000 Then
Timer1.Interval = 0
Timer1.Enabled = False
Beep
End If



My question is: how can I also stop the mouse click from executing?

I have a 'color picker' program so the user can select any color on-screen, but when they click to select the pixel, the click changes Focus, or selects what's underneath, etc.

I want the pixel color, but not the mouse click....

Stop Screen Update During Macro Execution
My macro runs slow because it updates the screen as it processes each line of the spreadsheet. I believe there is a way of inhibiting screen update during macro execution.(?)

Dragging Controls Around A Form
I have an array of shape controls on my form. At runtime, I would like the user to be able to freely drag and drop the shapes around the form using their mouse.

I was thinking that this might be something to do with Shape1_DragDrop event, but I've not managed to get this to work.

Does anyone have any ideas?

Dragging A Frame Onto A Form
Hello people,
Maybe a trivial question, but I have some problems in doing that:
Simply I need to drag a frame on a surface occupied by a FlexGrid (fg). The only thing I need is this:
Ckick on the frame, drag it to another position of the fg and drop there.
I have set this code:

Private Sub Frame2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Frame2.DragMode = vbManual
m_intX = X
m_intY = Y
Frame2.Drag vbBeginDrag

Private Sub fg_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Frame2.Move X - m_intX, Y - m_intY
End Sub

Indeed the thing works, but only if the mouse pointer is not dragged on the frame itself. It is not so easy to explain, therefore please give me a suggestion to do that better.

Thank You to Everyone
Regards

TdP

Dragging Controls In A Form
This is what I would like to accomplish: I am dragging an image that will drop somewhere in the form. This is what's in my code:


VB Code:
Private LeftofImage1 As LongPrivate TopofImage1 As LongPrivate inmovement As Boolean Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    LeftofImage1 = X    TopofImage1 = Y    inmovement = TrueEnd Sub  Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)    If inmovement = True Then      Image1.Top = Image1.Top - (TopofImage1 - Y)      Image1.Left = Image1.Left - (LeftofImage1 - X)    End IfEnd Sub Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    inmovement = FalseEnd Sub


LeftofImage1 and TopofImage1 are the X and Y values of my image control before dragging, and inmovement checks whether or not it's still MouseDown.

Just to clairify, the image flickers to the opposite direction of where I want to go. Does anybody know how to fix this?

Form Dragging Event?
Is there any way to detect when the Form is being dragged?
I need some sort of event that fires continously when the form is being dragged, I mean like someone Mouse_Down in the titlebar and move the Form.
Some sort of Form_Resize event, but for dragging.

If I Add An Item Onto A Form, How Do I Go About Dragging It Around?
I been searching on these forums but cant find anything using VB 6

Prob On Dragging A Form
hello
i'm using a child form and wen i'm writing a code to drag a form on to the parent form its not working.
can anybody suggest a small example which is having a code related to form dragging
thnks

Dragging FrmSplash Form
Using VB 6.0 I added a form frmSplash in my project. I want to drag it with mose on runtime. How?

Dragging A Borderless Form
I have a form with BorderStyle 0 - How can I drag it and reposition it on the desktop?

Dragging Image On Form W/ Layers
Hello all. I've created a program that allows the user to drag pictures from one form to another, and also anywhere within a form. If the user is dragging the picturebox within the same form, the picture moves with the cursor (it doesn't just appear at the new cursor position when the drag is complete). I've used the BitBlt API to accomplish some of my program.

My problem: Along with what I currently have I would like one form to have multiple layers. I would like a user to be able to click on a picture and be able to type what layer to move it to in a textbox (say 1-10), or use arrows to move it a layer up or down, or some sort of system. Annnnyway, any suggestions of how to accomplish this?

Thanx

How Can I Move A Form By Clicking On It And Dragging It
Hi, Is there any way I can drag a from across my screen by clicking on it and dragging. There is no blue bar at the top and I dont want to have one (for cosmetic purposes).

Thanks in advance if you can help,

John

Dragging A Command Button Around The Form
Hi everyone, i am extremely new to VB and dont know very much at all, and i need a bit of help

I want to make an extremely simple program which has one command button on a form, i want to be able to drag the command button around the form and drop it into a new position.

This is what I have so far (bearing in mind that im not sure if this is correct)

Code:
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
          command1.drag vbbegindrag
end sub


And i want to know what i have to do to make the button change its position on the form depending on where you drop it, i think it is something to do with 'Command1_DragDrop' but am not sure

please try to keep it simple, im a newby

Move A Form In Win NT By Dragging The File
I am using the following code in mousemove event of a form

ReleaseCapture
Call SendMessage(me.hwnd, &H112, &HF012, 0)




This works fine and the form moves in win98 but the form doesent move at all in win NT 4. I havent tried it with other os.
Any one knows why and whats the workaround?

Thanks in advance.
-Sanjay
Sanjaykattimani@hotmail.com


-Sanjay kattimani

Dragging Listview From One Form To Another Form..
How to drag Listview Item to another form with the same format of Listview. not a Listitems???? hElp please??

MScomm Troubles Dragging Non Modal Form
I experienced this problem:
If I use a MScomm control receiving a continous stream of data from a serial port and I open and drag a non modal window the operating system crash after few seconds of operation.
Anybody experienced the same?
Have someone any hints or ideas to workaround the problem?

To duplicate the effect:

1. create a new project.
2. Add a form as Form2
3. on Form1 * * * three buttons "startcom", "stopcom", "newform"
4. add a MScomm1.ocx control
5. add a label1 and edit its caption = "0"
5. Paste the below code

note: The Startcom button open the comm port 1 at 38400 (but also different baud rate generates the same problem).
The Stopcom button stop the communications

6. Run the program
7. If you click on startcom the label1 begins to count the commevent
if you click on stopcom the label1 stops to count

8. If you click on newform a new form (form2) not modal will be opened
9. If the comm port is closed you can drag the form and continue
to drag it for an indefinite period of time around the desktop
10. if you open the comm and open a newform and drag it
for a while; the software will continue to process the oncomm events
but soon all the system will crash...

Any ideas???
Thank you!

Code:::

Private Sub startcom_Click()
MSComm1.Settings = "38400,n,8,1"
MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub

Private Sub stopcom_Click()
MSComm1.PortOpen = False
End Sub

Private Sub newform_Click()
Form2.Show 0
End Sub

Private Sub MSComm1_OnComm()
a$ = MSComm1.Input
Label1.Caption = Val(Label1.Caption) + 1
End Sub

MDI Child Form Auto Scroll When Dragging
Here is my problem :

I have a couple of pictureboxes in an MDI child form that is bigger than its parent MDI form.
All pictures can be dragged from one box to another.
But because not all the pictureboxes are visible ( unless you scroll the MDI form ), it is impossible to drag let say Picture1 into Picture10 because Picture10 is not accessible.
Is there a way on drag event to make the MDI Form scroll automatically when it hits the borders of the form ?
Thanx !

Finding Out If The Form Itself Is Being Moved By Dragging On The Title Bar... ?
Hello ppl...

I'm using windows 2000's layering abilities to make my form semi-transparent when a user drags it around and make it opaque when the mouse button is released. The problem is that I can't find a way to check if the form is being dragged around. The mouse events of the form do not fire when the title bar is being dragged. All i want is a mechanism that tells me if the title bar is being dragged or not. Can anyone help me?

Asim

Dragging Form / Slider Etc. Stops Execution
My code needs to transmit regular packets onto a serial bus, however when the user holds the mouse down on a slider etc. then the transmit function stops until they let go

Is there a clever way to continue processing whilst this is happening?

I am thinking multithreading might be a way around this problem but is there a simpler way?

Cheers

Dock Form To Screen, Reserve Screen Space
Dear all,

I've searched and searched all over the Internet. I've posted messages in newsgroups and only gotten responses that basically tell me how to do the opposite of what I want while also suggesting that I should want to do it their way instead of mine.

This is what I want:

I want my application to "dock" to the top of the screen. It should become reserved space so that all other windows, when maximized, will only reach the bottom of my application.

I do NOT want it to "auto-hide"
I do NOT want the user to be able to "move" or "relocate" it to a different side of the screen.
I do NOT want the user to be able to "undock" it

Every sample or answer I can find is a way to do it with all the things I said I DON'T want, and all the code I have to pick through has been confusing me. I cannot find what I need to just dock the application upon loading and leave it there until exit.

I've been playing around with the sample application called "AppBar" which I think came from MSDN or from somewhere on the Internet, but that application starts off floating and you have to dock it yourself. I cannot manage to pick out the functionality of just docking it and leaving it there.

Help, please!
Thanks.
Dan

How To Check That Form Is Loded Or Not? And Also How To Stop Flikering Of Child Form?
Hii Friedns,

How to know that desire form is loded or not during run time?

and in my project i am using MDI form. During run time i am changing size of child form. But it does not look very good when it opens child form. How to give snappy look to that? It also takes to much time to load form.

Thanksin advance.

Hdave.

Form Stop
I have a splash screen in my program, its the first thing to load up when the program runs.

It will connect to the server, download updates, then run the main form which is a MDI form.

The problem is sometimes, for i have no clue why, it will load up the MDI form, but i cant keep focus on it.. I'll click it, and the title bar will turn gray, and it keeps doing that.. So i hit Ctrl+Break and i can see its constantly running through code on the splash screen! So i F8 through it to see whats triggering it... And i dont see anything...!! It starts in 1 section where it unloads the splash and loads the MDI form, which just so happens to me in the middle of an IF..Then statement after changing a lablel, but it starts in the random spot for i dont know why... ugg...

Then it moves on and goes through a Delay sub, then it goes through the Unload portion of the form a few times, then it goes back to the middle of that If.. Then statement, and when it hits End Sub, it starts on frmLoad!!

Looking through my code, i dont have a single line of code ANYWHER that loads that splash screen... I set the interval of the only timer on the form to 0 and disable it when its supposed to close that form, its not inside any loops, becuase there arent any loops (except for whats in the Delay sub), i close both winsock controls.. But it still loops through it all!

Is there a way to force close a form and make it cancel everything its doing? Or is there another fix for this problem?

Stop A Form
Is there a way to stop a form without stopping the whole program by using an end on a hard error.

If the user encounters certain types of errors I issue a rollback and then I want the form to unload and stop running. I cant just call an unload because after it goes through the unload process it moves into the next bit of code in that form. I need something that functions the the End does but only for that form.

Is this possible???

Stop Form From Continuing
Hello again.

On my form. I have a combobox with a list of names. The default text of this is "Please select a document."

Sometimes, when using this form, it's difficult to remember to drop the list down and pick a document. So I want to stop the form from adding data into the sheet when that option is selected.

This is my code so far.


Code:
Private Sub DisplayCmd_Click()

If DocLst.Value = "Please Select A Document ..." Then
Call InvalidDocProc
End If

..
..
..

End sub

Sub InvalidDocProc()

Message = MsgBox("You have not selected a valid document", vbOKOnly, "Invalid Selection ...")

End Sub
But when try to select this document, I get the message box, but then it just carries on with the DisplayCmd sub.

I don't want to exit the form, I just don't want it to continue. Is there anything I can do?

Stop Form Load
How can I stop a form load. I have an input box in a form load event which takes a value searches a database and displays the info on the form. If the user clicks cancel on the inputbox, how can I stop the form load?

Stop A Form From Unloading
I have a form with a media player on it (not the main form) and I want to stop it form unloading when the user closes it and just hide it instead, Me.Hide. I think I should be able to put some code in Form_QueryUnload to do this, but I don't know what.

Edit: The reason for this is so it will keep playing.

Stop Form Resizing
Is there a way to stop the form being rezied completley.
And is there a way to disable to resize corner thing in a status bar.

I know you can take away the min and max buttons, im talking about the program being a fixed size no matter what.

Thanks
-Dave

Trying To Stop A Form Moving
hi, i am making a program that has docking forms onto the main mdi form. I am trying to make it so that the forms can be docked and undocked. I have so far made a timer that keeps a form in its position all the time but when the user tries to drag the form it flashes and such and then returns to the position wheras i don't want it to move at all, is there any way i can subclass it to stop it moving?

Stop Form Process
Ok i have a few forms.

How can I stop the other forms from loading when I want only the main form to be loaded??

I will load other form only when i call them.

Stop Form Updating
I do some fairly complex manipulations of many of the controls on my form,
including location and size (even the size of the form itself). I want to
disable all screen refreshes until all this is complete, and just display
the result at the end. How can I do this? LockWindowUpdate does not do the job.

Stop MDI Form Being Resized
I have done a search on this and the only answer I can find is to subclass the form, so I have copied the code to a new module and changed the Private to Public (I think I have to do this)

It doesn't seem to do anything.

I don't confess to understand a lot of this code, so if somebody could explain what is wrong, and if possible, why as well please.

Here is the code in total:

vb Code:
Private Sub MDIForm_Load() 'Save handle to the form.gHW = Me.hwnd'Begin subclassing.Hook End Sub Option Explicit Private Const GWL_WNDPROC = -4Private Const WM_GETMINMAXINFO = &H24Private Type POINTAPI    x As Long    y As LongEnd Type Private Type MINMAXINFO    ptReserved As POINTAPI    ptMaxSize As POINTAPI    ptMaxPosition As POINTAPI    ptMinTrackSize As POINTAPI    ptMaxTrackSize As POINTAPIEnd Type Private Declare Function SetWindowLong Lib "user32" Alias _            "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _            ByVal dwNewLong As Long) As LongPrivate Declare Function DefWindowProc Lib "user32" Alias _            "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, _            ByVal wParam As Long, ByVal lParam As Long) As LongPrivate Declare Function CallWindowProc Lib "user32" Alias _            "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _            ByVal hwnd As Long, ByVal Msg As Long, _            ByVal wParam As Long, ByVal lParam As Long) As LongPrivate Declare Sub CopyMemoryToMinMaxInfo Lib "KERNEL32" Alias _            "RtlMoveMemory" (hpvDest As MINMAXINFO, ByVal hpvSource As Long, _            ByVal cbCopy As Long)Private Declare Sub CopyMemoryFromMinMaxInfo Lib "KERNEL32" Alias _            "RtlMoveMemory" (ByVal hpvDest As Long, hpvSource As MINMAXINFO, _            ByVal cbCopy As Long) Global lpPrevWndProc As LongGlobal gHW As Long             Public Sub Hook()'Start subclassing.lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, AddressOf WindowProc)End Sub Public Sub Unhook()Dim temp As Long'Cease subclassing.temp = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)End Sub Private Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, _                    ByVal wParam As Long, ByVal lParam As Long) As Long                    Dim MinMax As MINMAXINFO'Check for request for min/max window sizes.If uMsg = WM_GETMINMAXINFO Then    'necesary for the caption of an MDI child (when maximized)    WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)        'Retrieve default MinMax settings    CopyMemoryToMinMaxInfo MinMax, lParam, Len(MinMax)        'Specify new minimum size for window.    MinMax.ptMinTrackSize.x = (6000 / Screen.TwipsPerPixelX)    MinMax.ptMinTrackSize.y = (7365 / Screen.TwipsPerPixelY)        'Specify new maximum size for window.    MinMax.ptMaxTrackSize.x = Screen.Width    MinMax.ptMaxTrackSize.y = Screen.Height        'Copy local structure back.    CopyMemoryFromMinMaxInfo lParam, MinMax, Len(MinMax)    WindowProc = DefWindowProc(hw, uMsg, wParam, lParam)Else    WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)End If End Function

Stop MDI Form Unloading
I have a MDI ChildForm where a user may or may not have made changes.
I want to check, when the actual MDI Form is closed, if the user wants to save any changes made to the MDI ChildForm.

Firstly, if there have been any changes then the boolean value is set - blnUpdate.

Then there is a msgbox asking if the user want to save the changes.
Here is where I have the problem.
If the user selects 'OK' to save the details the following code runs, but then goes straight to the MDI Forms Unload event.

My code in the ChildForm QueryUnload is:

vb Code:
If blnUpdate = True Then   If MsgBox("You have made changes to the member's details." & vbCrLf & _            "To save the changes select 'OK'." & vbCrLf & _            "If not select 'Cancel'.", vbOKCancel + vbInformation, "Update details") = vbCancel Then            'don't save changes - close form            blnUpdate = False            MDIMain.sb1.Panels(3).Text = ""    Else            'save changes            If UnloadMode = 1 Then                Cancel = True            End If            Me.ZOrder 0    End IfEnd If

Copyright © 2005-08 www.BigResource.com, All rights reserved