forms
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
hello,
can anyone tell me how to open two forms at once when you start the program but one has to be on the left of the main form can anyone help me please?
can anyone tell me how to open two forms at once when you start the program but one has to be on the left of the main form can anyone help me please?
To add a new form to a project you right click the solution explorer then choose to add, then new windows form.
Once you have added it you can make it appear with Form.Show() and Form.ShowDialog().
If you want it to appear to the left of an existing form then before you show it you could set the StartPosition to Manual and use code like this:
Once you have added it you can make it appear with Form.Show() and Form.ShowDialog().
If you want it to appear to the left of an existing form then before you show it you could set the StartPosition to Manual and use code like this:
Code: Select all
newForm.Location = new Point(Me.Location.X - newForm.Width, Me.Location.Y)
mandai wrote:To add a new form to a project you right click the solution explorer then choose to add, then new windows form.I tried this code
Once you have added it you can make it appear with Form.Show() and Form.ShowDialog().
If you want it to appear to the left of an existing form then before you show it you could set the StartPosition to Manual and use code like this:Code: Select allnewForm.Location = new Point(Me.Location.X - newForm.Width, Me.Location.Y)
Code: Select all
But it still dosent work it shows form 2 and not form1? Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form2.Location = New Point(Me.Location.X - Form2.Width, Me.Location.Y)
Form2.ShowDialog()
End Sub
Hello,
Put the code into the "Form_Shown" event instead of "Form_Load":
Put the code into the "Form_Shown" event instead of "Form_Load":
Code: Select all
Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
Dim SecondForm As New Form2
SecondForm.Location = New Point(Me.Bounds.Left - SecondForm.Width, Me.Location.Y)
SecondForm.ShowDialog()
End Sub
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023