I have two form the parent form with the menu list and the child form.
I want to show the two form simultaneously or the main menu first and then the child form.Is it possible? Any idea?
on the load event of form1 just write form2.show()
is that it ?
If I will do what you suggest, the form2 will show first and the form1 will not show if I will not close the form2. I want them both visible. Any idea?
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Form2.Show() End Sub
Shows both forms overlapping. So ÜnLoCo gave you the right answer.
I try your suggestion but it only show form1 and form2 is missing.
here is solution first amke parent form proerit IsMdiContainer=true then when you load the parent form (i.e. MDi parent form) on the load event put this code
dim f2 as new form2 //which is my form2 protected sub form1_load f2=new form2 f2.MdiParent=me //this is form1 f.show() end sub try this it will work
open the Form2.Designer.vb file and paste the code of InitializeComponent
it should look like:
Private Sub InitializeComponent() components = New System.ComponentModel.Container Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.Text = "Form2" End Sub
Also make sure you havent set it to Visible=false and make sure Form2 is not behind Form1. just move the visible form to the side.
If this doesnt work then please paste us your code.
still the form2 does not show..:(
Show us your code else you wont find the solution.
This is my code for parent form load:
Private Sub frmParent_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim frm As New frmBCLoginForm Dim dateToday As Date frm.ShowDialog() If frm.logInAuthenticated = False Then frm.Dispose() Me.Close() End If Dim frm2 As New formChild frm2.MdiParent = Me frm2.Show() End Sub
I really need to show the parent form and the child form. Please help!
ok when you load the MDIparent form on the parent form's load event put hits code
Private Sub MDIParent1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Show() f1 = New Form1 //form1 is login form f1.MdiParent = Me f1.Show() End Sub
if the login is sucessfull then close your form2 else if you want to show other form then write else codtion and show other form on button clik event of login form.
Login has different case. The login form should show before the parent show. If the login is successfull then the login form should be close and the parent and the child form should be shown simultaneously.
The menustrip is located in the parent form. I want to show them simultaneously because I want that the child form can see the menuStrip and the user can open other forms. Hope you understand.
set the startup form is login form. if you don't know how to go startup page then go to theproject properites and and set it to login form and then sussessfulle login button put this code on MDIparent form load event
dim f1 as firm Private Sub MDIParent1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Show() f1 = New Form f1.MdiParent = Me f1.Show() End Sub