Visual Basic Foro

Programación => Visual Basic 6 => Mensaje iniciado por: polosa en Agosto 11, 2012, 10:26:52 am

Título: I have a question to ask everyone list of virtual
Publicado por: polosa en Agosto 11, 2012, 10:26:52 am
My English is not good sorry.

I try to create a quick list of virtual.As shown below
(http://i.imgur.com/meUyN.jpg)

When many of the list items. Remove items without any problems.
When I left the two projects I try to delete one of the items but at the same time remove the two projects.
Wrong I Remove it?
(http://i.imgur.com/n7reA.jpg)

http://www.mediafire.com/?qv8122rlruia953
Título: Re:I have a question to ask everyone list of virtual
Publicado por: LeandroA en Agosto 12, 2012, 02:27:39 am
Hi Polosa check this

Citar
Public Sub Remove(ByVal nIndex As Long)
    Dim i As Long
   
    On Error GoTo Err_Proc
   
    If nIndex < 0 Or nIndex > mCount Then
        Debug.Print "Error RemoveItem"
    Else
        If mCount > 0 Then
            '// shift data left
            For i = nIndex To mCount
                If i + 1 <= mCount Then
                    mFile(i) = mFile(i + 1)
                End If
            Next
                       
            mFile(mCount) = vbNullString
        End If
       
        mCount = mCount - 1
        mNewIndex = mCount - 1
       
        If mCount >= 0 Then  '<-----------------here
            If mCount + C_STEP < UBound(mFile) Then
                ReDim Preserve mFile(0 To mCount) As String
            End If
        Else
            Clear
        End If
    End If
   
Exit_Proc:
    Exit Sub
   
Err_Proc:
    Debug.Print "Error RemoveItem"
   
    Err.Clear
    Resume Exit_Proc
End Sub

Question: "Collection (http://www.daniweb.com/software-development/visual-basic-4-5-6/threads/122547/collections-in-vb6.0#post600779)" will be slow?