Click here to Skip to main content
15,900,461 members
Home / Discussions / C#
   

C#

 
AnswerRe: SetSystemTime Return Parameters Pin
Mircea Puiu8-Jan-07 22:35
Mircea Puiu8-Jan-07 22:35 
QuestionRe: SetSystemTime Return Parameters Pin
alefaga8-May-09 4:56
alefaga8-May-09 4:56 
AnswerRe: SetSystemTime Return Parameters Pin
Tyler458-May-09 4:59
Tyler458-May-09 4:59 
QuestionSending Email in .Net 2.0 Pin
Sarika Wake8-Jan-07 20:35
Sarika Wake8-Jan-07 20:35 
AnswerRe: Sending Email in .Net 2.0 Pin
Chris Buckett8-Jan-07 22:04
Chris Buckett8-Jan-07 22:04 
QuestionMIME Type in c# Pin
aruna_koride8-Jan-07 19:15
aruna_koride8-Jan-07 19:15 
AnswerRe: MIME Type in c# Pin
Mircea Puiu8-Jan-07 21:53
Mircea Puiu8-Jan-07 21:53 
Questionconst member function Pin
Maddie from Dartford8-Jan-07 18:00
Maddie from Dartford8-Jan-07 18:00 
AnswerRe: const member function Pin
Christian Graus8-Jan-07 18:04
protectorChristian Graus8-Jan-07 18:04 
GeneralRe: const member function Pin
led mike8-Jan-07 18:25
led mike8-Jan-07 18:25 
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 

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.