Solved

Close a form in a usercontrol

Posted on 2015-01-05
3
170 Views
Last Modified: 2015-01-05
I have a form I use to login as a different user - if I click cancel it closes the entire application and not just the form
the form is called from a usercontrol
Forms.Login li = new Forms.Login(); 
public void ShowLogin(string title)
        {
            li.title = title;
            li.ShowDialog();
        }

Open in new window

in the code for the cancel button I am using
((Form)this.TopLevelControl).Close();

Open in new window

like I said - after cancel is selected the entire app closes
what am I not seeing here
0
Comment
Question by:r3nder
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 40531902
Is this what you want?
((Form)this.Parent).Close();
0
 
LVL 6

Author Comment

by:r3nder
ID: 40532039
I tried that and it didnt work - then I cleaned the solution and it worked - go figure :D
0
 
LVL 6

Author Closing Comment

by:r3nder
ID: 40532041
thanks Andy
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wpf develop 5 35
index Out OF Range Exception error 4 32
Base1 Encode/Decode 3 35
Iterate two lists and remove inactive 11 38
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now