Results 1 to 13 of 13

Thread: [RESOLVED] A still I have problem with docking Form to Form

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    Resolved [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.
    I know, I know, my English is bad, sorry .....

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    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
    I know, I know, my English is bad, sorry .....

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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

  5. #5
    Addicted Member xavierjohn22's Avatar
    Join Date
    Oct 2006
    Location
    Approx. 4921' and 3.11" asl
    Posts
    249

    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

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    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
    Attached Files Attached Files
    I know, I know, my English is bad, sorry .....

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    Re: A still I have problem with docking Form to Form

    Someone know, please help me
    I know, I know, my English is bad, sorry .....

  8. #8
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    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.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    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

    You see now?

    Tamgovb
    I know, I know, my English is bad, sorry .....

  10. #10
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    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?

  11. #11
    Addicted Member xavierjohn22's Avatar
    Join Date
    Oct 2006
    Location
    Approx. 4921' and 3.11" asl
    Posts
    249

    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.
    Attached Files Attached Files
    Last edited by xavierjohn22; Jun 12th, 2007 at 11:00 AM.

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2005
    Location
    in Poland
    Posts
    390

    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.
    Attached Files Attached Files
    I know, I know, my English is bad, sorry .....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width