Need a little help on this since it seems to be vastly different than VB6.

I have multiple forms and would like to set the Startup Position of secondary forms (form2 & form3) slightly lower, and to the right of the primary form (form1); similar to the 'cascade' effect in Excel. Note that the primary form is NOT an MDI Container.

I've have form1 Startup Position = CenterScreen and all subsequent forms are set as Manual.

In VB6, a form had a Left & Top property and we could code something like:

form2.top = form1.top - 100: form2.left = form1.left + 100

Is there a similar, non-rocket science way to do this in .NET?

Appreciate your help,

5 Years
Discussion Span
Last Post by Luc001


In the Form2 Class add the form2_location event and then you can try this:

 Private Sub Form2_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LocationChanged
        Me.Location = New Point(Form1.Location.X + 30, Form1.Location.Y + 30)
    End Sub
Votes + Comments
Perfect answer


You could not have picked better numbers :)
Although I didn't use the event itself, I used your:
"Me.Location = New Point(Form1.Location.X + 30, Form1.Location.Y + 30)" in the form_load event and it worked perfectly; exactly where I wanted it to cascade.

Thanks very much,

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.