-
June 8th, 2010, 10:07 AM
#1
[RESOLVED] How do I change which form opens first?
I tried changing the start-up object, but all I have in there is something with a *.Program as its name. It doesn't seem to change regardless of how many forms I have. Right now, Form1 opens first (yeah, I know I should change the names), but I'm wondering what chooses this to be the form that should execute first. Why not Form2 or Form3?
I was also wondering why closing the parent form also closes the child form. I know it's because that one is a parent and one is a child, but where else would I open the form to make them completely independent?
EDIT: Also, I use .NET 4.
Thanks!
EDIT: I seem to have come across something called Program.cs, which does most of what I want. However, I'm still not sure how to open two forms at the same time from Program.cs.
Last edited by Octanum; June 8th, 2010 at 10:15 AM.
-
June 8th, 2010, 10:58 AM
#2
Re: How do I change which form opens first?
Seeing as you've been able to answer your first question - then for your edit-question; then you should be able to open the second form from the load event from your first form.
-
June 8th, 2010, 11:06 AM
#3
Re: How do I change which form opens first?
Originally Posted by Alsvha
Seeing as you've been able to answer your first question - then for your edit-question; then you should be able to open the second form from the load event from your first form.
Ah, perfect, thanks! Out of curiosity, if I were to initially load Form1, then load Form2 from Form1, how would I access the variables of Form1 in Form2. I tried making the Form1 variable I want to access a "public static" and this seems to have worked and I can just access it with Form1.VariableName from Form2. Was this the correct way of doing it or is there perhaps a better way?
I'm also not sure how I would close Form1 from Form2 because nothing else can be accessed except the variable I made a "public static".
EDIT: Alright, seems I have solved the problem.
In the child form (Form2), I created an instance of Form1. So "public Form1 parentForm".
Now, when I create the child form in Form1, I can set parentForm equal to "this".
Last edited by Octanum; June 8th, 2010 at 11:57 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|