form startup location

izzyq8

Member
Joined
Dec 29, 2007
Messages
21
Programming Experience
Beginner
ok after tampering a bit my program now opens new forms instead of a group box
VB.NET:
  For Each tp As TabPage In TabControl1.TabPages
            Dim tabs As New TabControl
            Dim from As New Form
            
            

            from.Controls.Add(tabs)

            tabs.Controls.Add(TabControl1.TabPages.Item(0))
            tabs.Visible = True
            from.Visible = True
            'from.Location = New Point(300, 300)

        Next

my question is when i deploy it they open all on top of each other
i need it to deploy them next to each other
i tried the from.location but with no luck. john i need u :(
btw good cake chioce but i personnly would have said choclate :p
 
I think you have to set both Location and set FormStartPosition to Manual.
 
ok did the startpostion to maunal but still loads over each over
not sure i get the location bit
VB.NET:
Dim f As New Form
f.Location = New Point(100, 100)
f.StartPosition = FormStartPosition.Manual
f.Show()
If you're opening 2 forms and want to position them non-overlapping you have to calculate the point relative to the other forms bounds. Say, if first x Location is 100 and its width is 200 your next forms x Location is (f1.Location.X+f1.Width=300).
 
Back
Top