How can i avoid from showing another Form when closing the program Form1?
<p>In the closing event i have this:</p>

<pre><code>private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            FormIsClosing = true;
            KeysValuesUpdate();
        }
</code></pre>

<p>FormIsClosing is a flag.</p>

<p>Then this is the KeysValuesUpdate function:</p>

<pre><code>public void KeysValuesUpdate()
        {
            using (var w = new StreamWriter(keywords_path_file))
            {
                if (FormIsClosing == true)
                crawlLocaly1 = new CrawlLocaly(this);
                crawlLocaly1.StartPosition = FormStartPosition.CenterParent;
                if (FormIsClosing == true)
                DialogResult dr = crawlLocaly1.ShowDialog(this);
                if (dr == DialogResult.OK)
                {
                    if (LocalyKeyWords.ContainsKey(mainUrl))
                    {
                        LocalyKeyWords[mainUrl].Clear();
                        LocalyKeyWords[mainUrl].Add(crawlLocaly1.getText());
                    }
                    else
                    {
                        LocalyKeyWords[mainUrl] = new List&lt;string&gt;();
                        LocalyKeyWords[mainUrl].Add(crawlLocaly1.getText());
                    }
                    Write(w);
                    ClearListBox();
                }
                if (dr == DialogResult.Cancel)
                {
                    Write(w);
                }
            }
        }
</code></pre>

<p>The problem is if im doing just if (FormIsClosing == true) the the next line i want not to take effect im getting error on it:</p>

<p>Error   1   Embedded statement cannot be a declaration or labeled statement
And the line after it : dr is unsigned.</p>

<p>If im doing:</p>

<pre><code>if (FormIsClosing == true)
{
                    DialogResult dr = crawlLocaly1.ShowDialog(this);
}
</code></pre>

<p>Then dr is unsign on this line: if (dr == DialogResult.OK)</p>

<p>What i want to archive is that if i close my application just dont show this dialog first.
And the line that show the dialog is: DialogResult dr = crawlLocaly1.ShowDialog(this);</p>
