How do i add the Key + Value to a ListBox?
<p>I have this button click code wich is working now:</p>

<pre><code>private void button6_Click(object sender, EventArgs e)
        {

            using (var w = new StreamWriter(keywords))
            {
                crawlLocaly1 = new CrawlLocaly();
                crawlLocaly1.StartPosition = FormStartPosition.CenterParent;
                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);
                    listBox1.Items.Add("Url: " + LocalyKeyWords[mainUrl] + " --- " + "Localy KeyWord: " + crawlLocaly1.getText());
                }
                if (dr == DialogResult.Cancel)
                {
                    Write(w);
                }
            } 
        }
</code></pre>

<p>I need that when i make a change either to the mainUrl(key) or to the crawlLocaly1.getText()(the value of the key) so it iwll change in real time also in the ListBox. I tried to do it like this:</p>

<pre><code>listBox1.Items.Add("Url: " + LocalyKeyWords[mainUrl] + " --- " + "Localy KeyWord: " + crawlLocaly1.getText());
</code></pre>

<p>But its not showing the key and its vlaue and its adding a new line instead of updating only the value of the key if the key already exist or if the key is not exist in the List to add to the ListBox the new key and its value.</p>

<p>How do i make it so it will update it in real time in the ListBox ?</p>

<hr>

<p>Ok changed the ListBox line to:</p>

<pre><code>listBox1.Items.Add("Url: " + mainUrl + " --- " + "Localy KeyWord: " + crawlLocaly1.getText());
</code></pre>

<p>Now its adding it good but its adding it as a new line. I want that it will add it and replace the line that already the mainUrl exist in the ListBox.</p>

<p>And if the mainUrl is not exist in the ListBox then add it with its value in a new line. 
But all the time if the Key(mainUrl) exist in the ListBox replace it or change only the value(crawlLocaly1.getText() ) .</p>
