|
-
Mar 6th, 2006, 08:53 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Can't unload controls created at design time!
In a WebBrowser project, I want a dynamic menu to pop-up when a Picture is clicked. The menu in the Menu Editor looks like this:
Back (mnuBack)
----BArrow(0) (mnuBArrow)
When the Picture is clicked, the menu shows a list of URLs the user had visited before the URL he is currently visiting. So if the user has visited the following sites (in the order specified)
http://www.google.com
http://www.vbforums.com
http://www.hotmail.com
& the user is currently viewing http://www.yahoo.com, then clicking the Picture would show the menu having the above 3 URLs. If any of the URLs is clicked in the menu, he should be taken to that site. Not only this, that URL in the menu should be deleted from the menu as well. This is what I have done to implement this:
VB Code:
Private Sub mnuBArrow_Click(Index As Integer)
Dim i As Integer
'imgCboURL(0) is the ImageCombo Address Bar
imgCboURL(0).Text = Me.mnuBArrow(Index).Tag
wWeb.Navigate2 mnuBArrow(Index).Tag
For i = 0 To Me.mnuBArrow.UBound
If (Me.mnuBArrow(i).Tag = Me.imgCboURL(0).Text) Then
Unload Me.mnuBArrow(i)
End If
Next
End Sub
What I find is if I click any URL in the menu apart from the 1st URL, then that URL gets deleted from the menu but if I click the 1st URL in the menu, then VB throws the Can't unload controls created at design time error.
So for e.g. if the menu lists the above 3 URLs, then clicking either http://www.vbforums.com or http://www.hotmail.com deletes the corresponding URL from the menu but if I click http://www.google.com, then VB generates the above mentioned error.
First of all, why is VB generating this error & secondly, how do I resolve the issue?
ARPAN
IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!
NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!
PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|