AYUDA URGENTE
Publicado por EMGA (29 intervenciones) el 01/09/2008 15:59:25
Quien puede ayudarme es algo urgente lo que sucede es que tengo este cod de vb6 y necesitomigrarlo para vb.net y siempre me saca error con lo del listview asi que si alguien puede ayudarme con este problema se lo agradesco aqui les dejo el cod con el que tengo problema por si alguien me puede ayudar y muchas gracias nueva mente.
Public Sub ListarArchivos()
Dim Item1 As ListViewItem
Dim pData As WIN32_FIND_DATA
Dim hFind As Long 'handle usado para buscar fichs en FTP
Dim ret As Long 'valor devuelto por API
m_form.Cursor = Cursors.WaitCursor
'crea buffer
pData.cFileName = String(MAX_PATH, 0)
'busca el primer fichero
hFind = FtpFindFirstFile(HandleConect, "*.*", pData, 0, 0)
m_listView.Items.Clear()
'Si Hfind vale 0 es porque no hay archivos ni directorios
If hFind = 0 Then
Item1 = ListView.Items.Add(, , "../Subir un nivel", , "carpeta")
Item1.SubItems(2) = getFecha(pData)
m_form.Cursor = Cursors.Default
Exit Sub
End If
Item1 = ListView.Items.Add(, , "../Subir un nivel", , "carpeta")
If pData.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY Then
Item1 = ListView.Items.Add(, , pData.cFileName, , "carpeta")
Item1.SubItems(2) = getFecha(pData)
Else
Item1 = ListView.Items.Add(, , pData.cFileName, , "archivo")
Item1.SubItems(1) = Round((pData.nFileSizeLow / 1024), 2) & " Kb"
Item1.SubItems(2) = getFecha(pData)
End If
'si no hay mas Archivos sale
If hFind = 0 Then
m_form.Cursor = Cursors.Default
Exit Sub
End If
Do
'crea buffer
pData.cFileName = String(MAX_PATH, 0) 'se llena con nulos
'find the next file
ret = InternetFindNextFile(hFind, pData)
'si no hay ficheros, no sigue
If ret = 0 Then Exit Do
If pData.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY Or _
pData.dwFileAttributes = 0 Then
'Agrega el nombre del directorio
Item1 = ListView.Items.Add(, , pData.cFileName, , "carpeta")
Item1.SubItems(2) = getFecha(pData)
Else
'agrega el archivo y Muestra el tamaño del mismo en el LV
Item1 = ListView.Items.Add(, , pData.cFileName, , "archivo")
Item1.SubItems(1) = Round((pData.nFileSizeLow / 1024), 2) & " Kb"
Item1.SubItems(2) = getFecha(pData)
End If
Loop
'Cerramos el handle de búsqueda
InternetCloseHandle(hFind)
m_listView1.Sorted = True
m_form.Cursor = Cursors.Default
End Sub
Public Sub ListarArchivos()
Dim Item1 As ListViewItem
Dim pData As WIN32_FIND_DATA
Dim hFind As Long 'handle usado para buscar fichs en FTP
Dim ret As Long 'valor devuelto por API
m_form.Cursor = Cursors.WaitCursor
'crea buffer
pData.cFileName = String(MAX_PATH, 0)
'busca el primer fichero
hFind = FtpFindFirstFile(HandleConect, "*.*", pData, 0, 0)
m_listView.Items.Clear()
'Si Hfind vale 0 es porque no hay archivos ni directorios
If hFind = 0 Then
Item1 = ListView.Items.Add(, , "../Subir un nivel", , "carpeta")
Item1.SubItems(2) = getFecha(pData)
m_form.Cursor = Cursors.Default
Exit Sub
End If
Item1 = ListView.Items.Add(, , "../Subir un nivel", , "carpeta")
If pData.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY Then
Item1 = ListView.Items.Add(, , pData.cFileName, , "carpeta")
Item1.SubItems(2) = getFecha(pData)
Else
Item1 = ListView.Items.Add(, , pData.cFileName, , "archivo")
Item1.SubItems(1) = Round((pData.nFileSizeLow / 1024), 2) & " Kb"
Item1.SubItems(2) = getFecha(pData)
End If
'si no hay mas Archivos sale
If hFind = 0 Then
m_form.Cursor = Cursors.Default
Exit Sub
End If
Do
'crea buffer
pData.cFileName = String(MAX_PATH, 0) 'se llena con nulos
'find the next file
ret = InternetFindNextFile(hFind, pData)
'si no hay ficheros, no sigue
If ret = 0 Then Exit Do
If pData.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY Or _
pData.dwFileAttributes = 0 Then
'Agrega el nombre del directorio
Item1 = ListView.Items.Add(, , pData.cFileName, , "carpeta")
Item1.SubItems(2) = getFecha(pData)
Else
'agrega el archivo y Muestra el tamaño del mismo en el LV
Item1 = ListView.Items.Add(, , pData.cFileName, , "archivo")
Item1.SubItems(1) = Round((pData.nFileSizeLow / 1024), 2) & " Kb"
Item1.SubItems(2) = getFecha(pData)
End If
Loop
'Cerramos el handle de búsqueda
InternetCloseHandle(hFind)
m_listView1.Sorted = True
m_form.Cursor = Cursors.Default
End Sub
Valora esta pregunta


0