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:
For Each strFav As DirectoryInfo In diFavorite.GetDirectories 'get folder names strsplit = Split(strFav.ToString, "\", , CompareMethod.Text) 'populate subfolder with folder name subFolders = New ToolStripMenuItem(strsplit(0)) 'populate subfolder with any url's found in it For Each url As FileInfo In strFav.GetFiles 'remove file extention and set favorite names strFavPath = url.Name.Substring(0, url.Name.Length - 4) 'open streamreader and store as Url as FUrl StReader = url.OpenText fUrl = StReader.ReadToEnd 'Get url to add to tag fUrl = fUrl.Substring(fUrl.LastIndexOf("URL=") + 4) 'see if there's any spaces within fUrl, they have to be removed 'or an url error will occur If String.Compare(fUrl.Substring(0, fUrl.Length), " ") Then 'use i to get end of url Dim i As Integer 'Use space to seperate url from other random info i = fUrl.IndexOf(CInt(Val(" "c))) If i <> -1 Then fUrl = fUrl.Substring(0, i) End If End If 'add List of favorites to mnuFavorites subFolders.DropDownItems.Add(strFavPath, Nothing, New eventhandler(AddressOf mnuFavorites_Click)).Tag = fUrl Next 'add subfolder to favorites menu mnuFav.DropDownItems.Add(subFolders)
Where am i going wrong...
Redmo


Reply With Quote