i'm building an IE clone, and i'm working on a favorites menu, i'm using a toostripmenuitem to do it, i have no problem populating the menu with both folders and url's. The only problem is the tag that holds the actual url isn't always working. Here's what i'm using to populate the menu item

VB Code:
  1. For Each strFav As DirectoryInfo In diFavorite.GetDirectories
  2.                 'get folder names
  3.                 strsplit = Split(strFav.ToString, "\", , CompareMethod.Text)
  4.                 'populate subfolder with folder name
  5.                 subFolders = New ToolStripMenuItem(strsplit(0))
  6.                 'populate subfolder with any url's found in it
  7.                 For Each url As FileInfo In strFav.GetFiles
  8.                     'remove file extention and set favorite names
  9.                     strFavPath = url.Name.Substring(0, url.Name.Length - 4)
  10.                     'open streamreader and store as Url as FUrl
  11.                     StReader = url.OpenText
  12.                     fUrl = StReader.ReadToEnd
  13.                     'Get url to add to tag
  14.                     fUrl = fUrl.Substring(fUrl.LastIndexOf("URL=") + 4)
  15.                     'see if there's any spaces within fUrl, they have to be removed
  16.                     'or an url error will occur
  17.                     If String.Compare(fUrl.Substring(0, fUrl.Length), " ") Then
  18.                         'use i to get end of url
  19.                         Dim i As Integer
  20.                         'Use space to seperate url from other random info
  21.                         i = fUrl.IndexOf(CInt(Val(" "c)))
  22.                         If i <> -1 Then
  23.                             fUrl = fUrl.Substring(0, i)
  24.                         End If
  25.                     End If
  26.                    
  27.                     'add List of favorites to mnuFavorites
  28.                     subFolders.DropDownItems.Add(strFavPath, Nothing, New eventhandler(AddressOf mnuFavorites_Click)).Tag = fUrl
  29.  
  30.                 Next
  31.  
  32.                 'add subfolder to favorites menu
  33.                 mnuFav.DropDownItems.Add(subFolders)

Where am i going wrong...

Redmo