Results 1 to 2 of 2

Thread: Control array element '1' doesn't exist!

  1. #1

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Control array element '1' doesn't exist!

    A WebBrowser project has a ImageCombo address bar & a dynamic menu. The menu lists the URLs the user has visited in a particular session. Clicking a URL in the menu takes the user to that particular site. Thw tag of each menu item stores the URLs.

    Now what I want is if the tag of any of the menu items is the same as the URL in the address bar, that item should be unloaded from the menu. This is how I tried it:
    VB Code:
    1. Private Sub mnuArrow_Click(Index As Integer)
    2.     Dim i As Integer
    3.     imgCboURL(0).Text = Me.mnuArrow(Index).Tag
    4.     wWeb.Navigate2 Me.mnuArrow(Index).Tag
    5.     For i = 0 To Me.mnuArrow.UBound
    6.         If (Me.mnuArrow(i).Tag = imgCboURL(0).Text) Then
    7.             Unload Me.mnuArrow(i)
    8.         End If
    9.     Next
    10. End Sub
    Now assume that the menu has 3 URLs. When I click the 1st URL, the address in the ImageCombo changes & the user is taken to that site. Now the menu has only 2 items. Next I click the 1st URL (among the 2 URLs) in the menu. The address in the address bar changes & the user is taken to that site but after that, VB generates the Control array element '1' doesn't exist error pointing to the If condition in the above code.

    Now what does this error mean & how do I resolve this 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?

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width