Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
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
 
Old June 30th, 2004, 06:51 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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...

 
Old June 30th, 2004, 08:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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.
 
Old June 30th, 2004, 08:44 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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....

 
Old June 30th, 2004, 09:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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.
 
Old June 30th, 2004, 09:12 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?
 
Old June 30th, 2004, 09:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Well, TextBox & Label & all controls have that methods (hide, show & ...)]
u can use them.

HTH.

Always:),
Hovik Melkomian.
 
Old June 30th, 2004, 09:25 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 ???

 
Old June 30th, 2004, 09:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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.
 
Old June 30th, 2004, 09:34 AM
Authorized User
 
Join Date: Jun 2004
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I see and thank you so much for your time again. Very much appreciated.

 
Old June 30th, 2004, 09:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Always Welcome :)
Excuse me, r u German?! I saw a .de link in ur page. I just wonder cuz of something...

Always:),
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Cascading forms, form start locations pigparent Visual Basic 2005 Basics 3 June 27th, 2008 10:34 AM
How can I make my main form start up invisibly? dylanbutler Visual Studio 2005 1 May 16th, 2008 08:47 AM
how to set a form as startup form in vb.net 2.0 mallikalapati .NET Framework 2.0 1 February 21st, 2008 09:19 AM
How to auto load(on start) a form in access 2000? method Access 1 June 17th, 2005 10:55 PM
how to start new form q8z Beginning VB 6 2 October 26th, 2004 05:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.