Hey,
During my development of web browser i have encountered a problem. The problem is that on my bookmarks panel if a user adds a bookmark that's already on the panel, the application gets an error and has to quit.
I tried surrounding the code with a try catch statement but then i get another error! This is the error
Invalid URI: The format of the URI could not be determined.
Here is my code;
private int faviconIndex(string url)
{
try
{
Uri key = new Uri(url);
if (!imgList.Images.ContainsKey(key.Host.ToString()))
imgList.Images.Add(key.Host.ToString(), favicon(url, "link.png"));
Uri keys = new Uri(url);
return imgList.Images.IndexOfKey(keys.Host.ToString());
}
catch
{
Uri keyi = new Uri(url);
return imgList.Images.IndexOfKey(keyi.Host.ToString());
}
}
When i take away the try/catch statement or the
return imgList.Images.IndexOfKey(keyi.Host.ToString());
It works fine except for the error when someone else adds the same bookmark.
Any help is much appreciated,
NSSLTD