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,

Hi,

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
commented: Perfect answer +3

Luc,

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,

Hi,

No problem, with plesure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.