Click here to Skip to main content
15,890,882 members
Home / Discussions / C#
   

C#

 
AnswerRe: const member function Pin
Guffa8-Jan-07 19:02
Guffa8-Jan-07 19:02 
GeneralRe: const member function Pin
CPallini8-Jan-07 21:17
mveCPallini8-Jan-07 21:17 
QuestionC# map template equivalent? Pin
swjam8-Jan-07 17:33
swjam8-Jan-07 17:33 
AnswerRe: C# map template equivalent? Pin
Christian Graus8-Jan-07 18:01
protectorChristian Graus8-Jan-07 18:01 
QuestionTerminating an Application ? Pin
Mike Bluett8-Jan-07 15:40
Mike Bluett8-Jan-07 15:40 
AnswerRe: Terminating an Application ? Pin
Lisa Jorgensen8-Jan-07 16:03
Lisa Jorgensen8-Jan-07 16:03 
GeneralRe: Terminating an Application ? Pin
Mike Bluett8-Jan-07 16:52
Mike Bluett8-Jan-07 16:52 
AnswerRe: Terminating an Application ? Pin
Lisa Jorgensen8-Jan-07 20:11
Lisa Jorgensen8-Jan-07 20:11 
First, I gave you bad (or at least incomplete) advice. I meant to say to use the Application.Idle event rather than the Load event. Calling Close from the Load event can cause a memory leak. You could do something like:

public partial class MainForm : Form
{
    public MainForm()
    {
        InitializeComponent(); <br> <br>

        // Code to determine whether to close form <br>
        
        if (ShouldClose)
        {
            Application.Idle += new EventHandler(Application_Idle);
        }
    } <br> <br>

    void Application_Idle(object sender, EventArgs e)
    {
        this.close();
    }
}

The Hide and Close methods don't work in the constructor because the Form is still being constructed. And in any case you don't want to close the form at this point, assuming the calling code looks something like:

Application.Run(new MainForm());

If MainForm is closed and disposed before it is constructed, then Application.Run will throw an ObjectDisposedException.
QuestionDisable Window Close Pin
MasterYoda798-Jan-07 14:07
MasterYoda798-Jan-07 14:07 
AnswerRe: Disable Window Close Pin
Luc Pattyn8-Jan-07 14:20
sitebuilderLuc Pattyn8-Jan-07 14:20 
GeneralRe: Disable Window Close Pin
MasterYoda799-Jan-07 6:08
MasterYoda799-Jan-07 6:08 
QuestionHow create "always on bottom" apps? Pin
noemailz8-Jan-07 11:56
noemailz8-Jan-07 11:56 
AnswerRe: How create "always on bottom" apps? Pin
Ravi Bhavnani8-Jan-07 12:25
professionalRavi Bhavnani8-Jan-07 12:25 
GeneralRe: How create &quot;always on bottom&quot; apps? Pin
Stephen Hewitt8-Jan-07 15:42
Stephen Hewitt8-Jan-07 15:42 
GeneralRe: How create &quot;always on bottom&quot; apps? Pin
Ravi Bhavnani8-Jan-07 16:27
professionalRavi Bhavnani8-Jan-07 16:27 
QuestionWindows form and controls not handling focus properly Pin
likefood8-Jan-07 11:42
likefood8-Jan-07 11:42 
AnswerRe: Windows form and controls not handling focus properly Pin
likefood8-Jan-07 11:58
likefood8-Jan-07 11:58 
QuestionWindows closing itself in a thread Pin
suck1238-Jan-07 11:21
suck1238-Jan-07 11:21 
AnswerRe: Windows closing itself in a thread Pin
Judah Gabriel Himango8-Jan-07 12:41
sponsorJudah Gabriel Himango8-Jan-07 12:41 
GeneralRe: Windows closing itself in a thread Pin
suck1238-Jan-07 19:22
suck1238-Jan-07 19:22 
GeneralRe: Windows closing itself in a thread Pin
Mircea Puiu8-Jan-07 23:54
Mircea Puiu8-Jan-07 23:54 
GeneralRe: Windows closing itself in a thread Pin
suck1239-Jan-07 2:18
suck1239-Jan-07 2:18 
GeneralRe: Windows closing itself in a thread Pin
Judah Gabriel Himango9-Jan-07 5:15
sponsorJudah Gabriel Himango9-Jan-07 5:15 
GeneralRe: Windows closing itself in a thread Pin
suck1239-Jan-07 5:43
suck1239-Jan-07 5:43 
QuestionSounds with c# Pin
sno-18-Jan-07 9:30
sno-18-Jan-07 9:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.