[RESOLVED] A still I have problem with docking Form to Form
Hi All
Not so long ago I got from Rhino a good code that solved my prob....but only a bit. I using this code in my app.
It works...but partly only because if you make moving FrmMAIN before clicking on a arrow and just then you click on a arrow then Form2 showing is in other position than should be.
And second problem it's such that when I minimize FrmMAIN it then Form2 to stay on a screen. I want that this Form2 also will to minimizing or it should be unloaded
Also I want that independently from a position FrmMAIN on a screen Form2 each time will be docking to FrmMAIN properly
Someone know haw to make?
Thanks in advance
Last edited by Tamgovb; Jun 12th, 2007 at 02:44 PM.
Re: A still I have problem with docking Form to Form
As far as the second problem (minimizing) goes:
Code:
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then Form2.WindowState = vbMinimized
'or
If Me.WindowState = vbMinimized Then Unload Form2
End Sub
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
Re: A still I have problem with docking Form to Form
You can't move or size Form1 when Form1 is minimized, but you can size Form2.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
Re: A still I have problem with docking Form to Form
i don't have a problem with al42's code, it works
Just set form2's showintaskbar = false property
Code:
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then Form2.WindowState = vbMinimized
If Me.WindowState = 0 Then Form2.WindowState = 0
End Sub
Re: A still I have problem with docking Form to Form
Thanks xavierjohn22.
Unfortunately a still nothing, I get the same error
In situation when I make so:
I run this Project, clicking on arrow, then I make minimizing for both this form
then with return I do the size to Normal (WindowState = 0) now I click on arrow and....
when I want to make minimizing it then I get the error with number '384'
I have line highlighted - see below
Code:
Public Sub CentreForm(F As Form)
NewWidth = FrmMAIN.Width + Form2.Width
F.Move (Screen.Width - NewWidth) \ 2, (Screen.Height - F.Height) \ 2
End Sub
Re: A still I have problem with docking Form to Form
Thanks for answer
I don't want to use MDI.
Oryginally posted by randem
I get no such error...
You don't get the error?
Make like below:
1. run this attachment of Project
2. click on drawing of arrow
3. minimalize both forms
4. restore to Normal the both forms
5. click on drawing of arrow for closing Form2
6. try to minimize FormMAIN, you should get this error now
Re: A still I have problem with docking Form to Form
You get the error because form2 is being unloaded when the picture is click.
In your center form in module form2 is part of the code.
Change it to something like if FOrm1 is minimized form2.hide,
You have to modify a bit on showing the forms to get the right position,
HERE attached. good day.
Last edited by xavierjohn22; Jun 12th, 2007 at 11:00 AM.
Re: A still I have problem with docking Form to Form
Code:
Public Sub CentreForm(F As Form)
If Not F.WindowState = vbNormal Then Exit Sub
NewWidth = FrmMAIN.Width + Form2.Width
F.Move (Screen.Width - NewWidth) \ 2, (Screen.Height - F.Height) \ 2
End Sub
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana