[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sliding a MDI child form in a MDI perant form

Posted on 2009-02-19
12
Medium Priority
?
1,486 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:bolson50
  • 6
  • 5
12 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 23688800
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
 
LVL 8

Expert Comment

by:bhmahler
ID: 23692019
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
 

Author Comment

by:bolson50
ID: 23707632
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 23707658
Are you setting the StartPosition to MANUAL?...

        Dim newForm As New OtherData
        newForm.MdiParent = MedOne
        newForm.StartPosition = FormStartPosition.Manual
0
 

Author Comment

by:bolson50
ID: 23717945
yes i did set the starting position to manual
it did not help
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 23718925
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
 

Author Comment

by:bolson50
ID: 23784838
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
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 23784990
WHERE is the code running from?...the MdiParent?  Another MdiChild?
0
 

Author Comment

by:bolson50
ID: 23785069
the code is running on a MDIchild form.
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 23785246
If you're running from another MdiChild then use:

    OtherData.MdiParent = Me.MdiParent
0
 

Author Closing Comment

by:bolson50
ID: 31549089
thanks a lot this works great
0
 

Author Comment

by:bolson50
ID: 23785481
thanks this works great
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question