bseos

bseos

  • NA
  • 1
  • 0

Combo box - add only if non existant

Apr 12 2007 12:27 PM
I have just started to get into C# coding as i have just begun my course. I have very basic knowledge so far, but i have a problem getting my combo box to only add items which arnt already added.

i am currently trying to write a basic mini browser which displays the url of the site in the combo box. The combobox is also used to enter urls and also to used as the drop down list to pick out previously visited websites . This part i have done.

But problem is i only want it to add (keep history) the sites which it doesnt have in the list (not to have more than 1 same address listed) and keep the addresses in most recently accessed order in the dropdown combobox from top being most recent.



My coding so far:: (Incase someone wants to see wat i have done)

private void myWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
urlCmb.Items.Add(urlCmb.Text);
}

private void goBtn_Click(object sender, EventArgs e)
{
urlCmb.Items.Add(urlCmb.Text);

Answers (1)