 |
| C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 30th, 2004, 06:51 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Start a form from a form?
Hi,
I am a newbie so bare with me... :D
I have two different forms, how do I start the second form from a button in the first form ??
Application.Run(new Form2()) does not work...
|
|

June 30th, 2004, 08:39 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Well, u r Wellcome!
u should get instance & show. do the folowing on ur Button_Click_Method in Form1:
Code:
Form2 fm = new Form2();
fm.ShowDialog();
HTH.
Always:),
Hovik Melkomian.
|
|

June 30th, 2004, 08:44 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you so much melvik. It worked like a charm. Much appreciated help.
One more question, is it hard to have the form clear out and have totally new buttons and labels and stuff with the press of a button and then go back to the original look ??
For example if I had one form called Form1 and that whould have 3 buttons when I would select the first button these three buttons would clear up and a registration form appear ??
I am sorry for these newbie questions, I am trying to learn Visual on my own here....
|
|

June 30th, 2004, 09:00 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Well Im not sure but it seems u wanna (Hide/Show) ur Controls.
If im right, plz see:
Code:
[u]Control</u>.Hide();
[u]Control</u>.Show();
[u]Control</u>.Dispose();
Keep in touch ;)
Always:),
Hovik Melkomian.
|
|

June 30th, 2004, 09:12 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi thanks again for your swift reply.
For example this Form here: Picture. I just have one button.
In my button_click method I had button1.Hide(); Very good it dissapears, but how can I inside this method make other controls lika a Label and a Textbox appear and perhaps a Back button to go back to this Picture?
|
|

June 30th, 2004, 09:21 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Well, TextBox & Label & all controls have that methods (hide, show & ...)]
u can use them.
HTH.
Always:),
Hovik Melkomian.
|
|

June 30th, 2004, 09:25 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
So I could just slam all my controls into one form and then have some of them starting hidden and some not, then as I click through the menus some controls would get hidden and others shown ??
doesn't that become quite messy when you are writing complex programs ???
|
|

June 30th, 2004, 09:31 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Hmm, complex programs need complex handling too!
Of course that was only a simple way to hide/Show Controls.
u can make ur form without them (not hide) & then creat them when u need, OR ........
I just wanted to give u the simplest idea in visual programing.
Always:),
Hovik Melkomian.
|
|

June 30th, 2004, 09:34 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I see and thank you so much for your time again. Very much appreciated.
|
|

June 30th, 2004, 09:45 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
Always Welcome :)
Excuse me, r u German?! I saw a .de link in ur page. I just wonder cuz of something...
Always:),
Hovik Melkomian.
|
|
 |