-
I currently have this code:
Code:
If frm1.Left = frm2.Left + frm2.Width Then
End
End If
that code makes it so that the program ends when form 1 is exactly to the right side of form 2 it ends. how to i make it so that if its in range of about 100, it will still end
i hope my question was clear
thanks in advance
-
If you use End, some objects may not be unloaded correctly so don't use it. Unless you have a lot of modulebound objects, unload both forms, or any forms with unload statement, but if you have other objects in a module unload them first.
To catch and close even if you are within 100 twips (i guess) you just test the range:
If 100 < abs(frm2.Left + frm2.Width -frm1.Left) Then
-
thanks, but that didn't work for me, this is my code:
Code:
Dim lngReturnValue As Long
If Button = 1 Then
Call ReleaseCapture
lngReturnValue = SendMessage(frmMain.hwnd, WM_NCLBUTTONDOWN, _
HTCAPTION, 0&)
If 1 < Abs(frmMP3.Left + frmMP3.Width - frmMain.Left) Then
MsgBox "You're Close"
End If
End If
and any where every you move the form on the screen the message box pops up and i have 1600*1200 and the same thing happened when i put the 100 to 1 the same thing happens
-
What even are you placing this code in? MouseDown? Or MouseMove?
-
-
Try This
Code:
If 0 < (frmMP3.Left + frmMP3.Width - frmMain.Left) And 100 > (frmMP3.Left + frmMP3.Width - frmMain.Left) Then
MsgBox "You're Close"
-
-
why did you replace 100 with 1? remember we're talking about twips
-
i tired it with 100 and it didn't work
-
Are you sure you tried to attach the right side of the frm2 to the left side of frm1?
Are you sure the event you have the code in fires?
Are you sure the formnames are spelled correctly?