sliding a MDI child form in a MDI perant form

i am trying to make a MDI child form slide across the perant form in to place but i can not make the old form to disappear and when the new window slides my other child forn blinks for a second. here is my code i am not sure how to tweek it thanks for any help

         
General.Hide()
 
            Dim newForm As New OtherData
            newForm.MdiParent = MedOne
            newForm.Show()
            For i = 820 To 112 Step -1
                newForm.Top = 102
                newForm.Left = i - 1
            Next

Open in new window

bolson50Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Try slapping a DoEvents() and/or a Sleep() call in there:

            For i = 820 To 112 Step -1
                newForm.Top = 102
                newForm.Left = i - 1
                Application.DoEvents()
                System.Threading.Thread.Sleep(50) ' <-- may not be necessary or may be too slow
            Next
0
 
bhmahlerCommented:
You could always try the AnimateWindow API as well.  I have not tried it on a mdi child but worth a try.
http://pinvoke.net/default.aspx/user32/AnimateWindow.html
0
 
bolson50Author Commented:
idle_mind sleep did not work or using a timer control.
bhmahler thanks this look like it will do the job buat i can not get it to work
i can not find a good example
i am not sure how to to make this work any idea thanks

    Shared Function AnimateWindow(ByVal hwnd As IntPtr, ByVal time As Integer, ByVal flags As AnimateWindowFlags) As Boolean

        Dim f2 As New OtherData
        AnimateWindow(f2, 1000, AnimateWindow.AW_VER_NEGATIVE., AnimateWindow.AW_SLIDE, AnimateWindow.AW_HIDE)
        AnimateWindow.AW_SLIDE()
        f2.Show()
    End Function
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Are you setting the StartPosition to MANUAL?...

        Dim newForm As New OtherData
        newForm.MdiParent = MedOne
        newForm.StartPosition = FormStartPosition.Manual
0
 
bolson50Author Commented:
yes i did set the starting position to manual
it did not help
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
This worked for me in VB.Net 2008:

        OtherData.MdiParent = Me
        OtherData.StartPosition = FormStartPosition.Manual
        OtherData.Location = New Point(820, 102)
        OtherData.Opacity = 0
        OtherData.Show()
        Application.DoEvents()
        OtherData.Opacity = 1
        For i = 820 To 112 Step -1
            OtherData.Left = i - 1
            Application.DoEvents()
        Next
0
 
bolson50Author Commented:
getting an error
Form that was specified to be the MdiParent for this form is not an MdiContainer. Parameter name: value

at this line OtherData.MdiParent = Me

if i change it to MedOne.MdiParent = Me
which is the perant form name
i get error  
Form cannot be both an MDI child and MDI parent. Parameter name: value

if i commit out the line
it works but the child window moves outside of the parent window

0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
WHERE is the code running from?...the MdiParent?  Another MdiChild?
0
 
bolson50Author Commented:
the code is running on a MDIchild form.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
If you're running from another MdiChild then use:

    OtherData.MdiParent = Me.MdiParent
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
bolson50Author Commented:
thanks a lot this works great
0
 
bolson50Author Commented:
thanks this works great
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.