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 September 25th, 2003, 11:08 AM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cannot close the Form

I cannot close the Login form.

After I click OK on Login form, the next form appears and I do not need Login form anymore. But when I try to close it in code, the application closes also. I think it happens because I open Login form in Main by Application.Run(new LoginForm()). I tried to open Login form using Show, but it doesn't work in main.

So how can I close Login form without closing application?

Thanks very much in advance
 
Old October 24th, 2003, 10:53 PM
Authorized User
 
Join Date: Jun 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to HuhOiC
Default

Can you give an example of your code because it should worrk with show method. Maybe you typed in some error.

RAyRAy
Huh O i C

Program or Be Programmed!!!
 
Old October 27th, 2003, 06:29 AM
Authorized User
 
Join Date: Aug 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oh my god !
Why do you open Login form by Application.Run(new LoginForm()); ? It not right !.
The best, you open it in :
private MainForm()
{
 ..........
 LoginForm f = new LoginForm();
 f.ShowDialog();
}

I think when you changes it to this, it not fault !
Best wishes.

L.V.L
 
Old October 31st, 2003, 05:02 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah, you have to keep your first form open from what i understand, if it's getting in your way just do this when opening the next form.

NextForm nf = new NextFrom();
nf.Show();
this.Hide();

then you cant see it or use it, haha!
Works for me...

jax






Similar Threads
Thread Thread Starter Forum Replies Last Post
Close all MdiChield form from open one form/Button salman .NET Framework 2.0 6 December 10th, 2007 03:21 AM
Close all MdiChield form from open one form salman .NET Framework 1.x 0 November 8th, 2007 12:32 AM
How To Close One Form And Show Another form Israr VS.NET 2002/2003 1 December 7th, 2004 12:30 PM
Form won't close sporkman43 VB How-To 2 March 17th, 2004 08:28 AM
How Do I Close a Form When I Move to Another Form. flyingfox VB.NET 2002/2003 Basics 3 December 29th, 2003 08:56 AM





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