[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
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
Re: A still I have problem with docking Form to Form
Thanks Al42, unfortunatelly i get the error '384' "A form can't be moved or sized while minimized or maximized"
Tamgovb:(
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.
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
1 Attachment(s)
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
Someone know, please help me
Re: A still I have problem with docking Form to Form
I get no such error... What are you attempting to do. It seems that you might be better off with using a MDI for as a container for your forms.
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
Quote:
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
You see now?
Tamgovb
Re: A still I have problem with docking Form to Form
Both forms are minimized so it is a valid error...
So, why this complicated method and why no MDI form?
What is it you really want to achieve?
1 Attachment(s)
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.
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
1 Attachment(s)
Re: A still I have problem with docking Form to Form
Hi
Thanks for all.
This prob I have a solved already, you have a look, how I made it.