Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Tazo on August 09, 2004, 02:29 PM

Title: Element Not Found
Post by: Tazo on August 09, 2004, 02:29 PM
I'm getting element not found when i do

Private Sub oscarSock_loggedOut(strFormattedName As String)
lstUsers.ListItems.Remove strFormattedName
End Sub

and to raise it,

              Case 4                    
                   pData 2, getTLV(strData, 1) 'store formatted name
                   A1 = Split(getTLV(strData, 5), ":", 2)
                   pData 3, getTLV(strData, 6)
                   pData 4, getTLV(strData, 17)
                   Winsock1(1).Close
                   Winsock1(1).Connect A1(0), A1(1)
                   RaiseEvent loggedOut(CStr(getTLV(strData, 1)))

Whats wrong? I even tried the lstusers part with parenthesees, still nothing
Title: Re:Element Not Found
Post by: CrAz3D on August 09, 2004, 04:22 PM
You are supposed to remove users by an index, not a string.  You are trying to remove them by a string.
Title: Re:Element Not Found
Post by: Tazo on August 09, 2004, 08:45 PM
does that mean I have to add each one with an index?
Title: Re:Element Not Found
Post by: Eli_1 on August 09, 2004, 09:20 PM
Note: People who know me, know that I have a hard time expressing things in words. I'll try my best to explain it, but bare with me.


Think of it more as an array.

Dim Blah(9) as String

That has a total of 10 different elements (0-9), and 10 different indexes.

Suppose each one of those (Blah(0) - Blah(9)) contains a person's name. One of them is "laurion." How would you search through that array and find the index that corresponds with that name? Most likely, you would use some kind of loop, and compare each element in the array to the name you're searching for to find the correct index which holds that name.

The same could be applied to a listview. Each name you see on a channel list has it's own corresponding index. To remove an item from that listview, you need to pass the index you want removed to the Remove function.
Title: Re:Element Not Found
Post by: MyndFyre on August 09, 2004, 09:46 PM
Quote from: Eli_1 on August 09, 2004, 09:20 PM

Dim Blah(9) as String

That has a total of 10 different elements (0-9), and 10 different indexes.
Actually, no -- that has a total of 10 different elements, and ten different indices.  The indices are 0-9 -- the elements are not.  The elements are referenced to by the indices as appropriate (and really, the elements are not referenced directly by numerical indices, but by the size of offset of one element to the next times the index into the array, but who's counting?)

The rest was right though :)
Title: Re:Element Not Found
Post by: Eli_1 on August 09, 2004, 11:58 PM
Oops, thanks for correcting my wrong information.  ;D
Title: Re:Element Not Found
Post by: MyndFyre on August 10, 2004, 07:58 PM
Quote from: Eli_1 on August 09, 2004, 11:58 PM
Oops, thanks for correcting my wrong information.  ;D

I got yer back.  I'm your support.  Just call me bra.  Er, bro.
Title: Re:Element Not Found
Post by: ChR0NiC on August 15, 2004, 04:06 PM
Don't forget we kind of discussed this matter here (http://forum.valhallalegends.com/phpbbs/index.php?board=31;action=display;threadid=7681)
Title: Re:Element Not Found
Post by: Newby on August 16, 2004, 07:44 PM
Quote from: laurion on August 09, 2004, 02:29 PM
I'm getting element not found when i do

Private Sub oscarSock_loggedOut(strFormattedName As String)
lstUsers.ListItems.Remove strFormattedName
End Sub

Should be something like:

Private Sub oscarSock_loggedOut(strFormattedName As String)
   listUsers.ListItems.Remove(listUsers.FindItem(strFormattedName).Index)
End Sub