Autor Tema: I have a question to ask everyone list of virtual  (Leído 1765 veces)

0 Usuarios y 1 Visitante están viendo este tema.

polosa

  • Bytes
  • *
  • Mensajes: 14
  • Reputación: +0/-0
    • Ver Perfil
I have a question to ask everyone list of virtual
« 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


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://www.mediafire.com/?qv8122rlruia953

LeandroA

  • Administrador
  • Petabyte
  • *****
  • Mensajes: 1128
  • Reputación: +151/-8
    • Ver Perfil
Re:I have a question to ask everyone list of virtual
« Respuesta #1 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" will be slow?