473,785 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Close form in C#

How can I close a form in C#?

Here is the code that I am using but closes everything?
private void frmSplash_Click (object sender, EventArgs e)

{

this.Close();

Form frmLogin = new frmLogin();

frmLogin.Show() ;

frmLogin.Activa te();

}


Nov 17 '05 #1
2 122577
Vivek Sharma wrote:
How can I close a form in C#?

Here is the code that I am using but closes everything?
private void frmSplash_Click (object sender, EventArgs e)

{

this.Close();

Form frmLogin = new frmLogin();

frmLogin.Show() ;

frmLogin.Activa te();

}

You are closing the current form before you show the next one which will
then break execution;
try
Form frmLogin = new frmLogin();

frmLogin.Show() ;

frmLogin.Activa te();

this.Close();
Nov 17 '05 #2
Hi,

Did you try ShowDialog instead of Show() ?

Are yui implementing a Splash screen? if so there are several example of how
to do it, search in the archives.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Vivek Sharma" <jo*@bloggs.com > wrote in message
news:eA******** ******@TK2MSFTN GP10.phx.gbl...
How can I close a form in C#?

Here is the code that I am using but closes everything?
private void frmSplash_Click (object sender, EventArgs e)

{

this.Close();

Form frmLogin = new frmLogin();

frmLogin.Show() ;

frmLogin.Activa te();

}

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1899
by: dwilliamjoe | last post by:
VB.net, launch procedure, close form, the whole APP is deactivated. When I say deactivated, other applications (Wind Explorer, My computer, Ect...) come to the foreground and my app goes to the back ground. The easiest way to reactivate the application, is selecting it from the taskbar. When my app is deactivated, its from pushing a button that launches a form (in its own thread), I suspect the thread has something to do with it but...
5
7448
by: AP | last post by:
IS there a way to run a procedure if the users close access directly rather than closing a menu screen that I have built? There is an event that works on close for this form, but it doesnt seem to run if the form is open and the suer just closes access all together, is there a way around this? Thanks
4
5258
by: Mindy | last post by:
I have two questions here: (1) what is the difference of close form and close table? (2) How "Prompt" works I used close form macro in my database. I hope when a user close the form, he/she will be asked if he/she wants to save the form (actually, I hope the user could decide if he or she want to add the new data to a database). I chose "prompt" in "Save" option of close macro. But there is no difference if I chose "yes" in "save"...
2
2803
by: Claudia Fong | last post by:
Hello everybody, I have a Menu form where I have a button. The user should click the button and the program should open another form call register form. I want that when the program show the register form, the menu form will close or hiden. I use the close () method, but it close everything (both forms) but if i use hide() method.. even when I close all the forms using the X button
6
5125
by: Robert Dufour | last post by:
On my form if the user clicks the upper right hand corner to close the form I want to trap that event and do a check to see if closing is allowed, if not, I want to stop the form closing action. Can anyone tell me how I can do this? Thanks for any help Bob
3
10577
by: kev | last post by:
Hi folks, I have a form for registration (frmRegistration) whereby i have two buttons. One is Save which saves record using the OnClick property. I used wizard to create the save button. The other one is Next button which i created to open another form "frmSummary" which displays back the records submitted. (i used the wizard to open form and find specific records to display. All these works superb until a review by users where they...
22
2496
AccessIdiot
by: AccessIdiot | last post by:
Hello all, I have a form (frm_Entrainment) with a button that opens a 2nd form (frm_Specimen_Entrainment). The 2nd form shares an ID field with the first form (Entrainment_ID - its like opening the Orders form for a particular Customer). I have a button on the 2nd form that says "return to the first form" which really is just sitting beneath the 2nd form. When the button is clicked it simply closes the 2nd form so you can see the 1st form...
2
2086
by: Hulas | last post by:
Guys, I have two questions. (a) How do I add two fields of the same table to a single combo box. For example if I have two fields ID1 and ID2 in a table called Identification, than how should I design a combobox in a form such that when I scroll down I get to see both the ID's. (b) I have a (Close Form) button on a form. Let's say I am adding a new record from a form and I am half way filling up everything and suddenly if I change my...
0
1610
by: ncsthbell | last post by:
I have an MS2007 access database. On one of the forms that is used to edit/change data, there is a button 'Return to main menu'. Once the user has finished making the changes on the form and clicks on this button, it runs a macro to close the form and open the main menu form. On the 'close' form it has the has the following: Object Type: form Object Name: DataEditInventory Save:Prompt From what I have read about the 'Save:Prompt',...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.