
27/06/2007, 04:31
|
 | | | Fecha de Ingreso: enero-2004
Mensajes: 519
Antigüedad: 21 años, 3 meses Puntos: 1 | |
Re: Preguntas varias de visual basic 6 (Archivos y PictureBox)
Código:
Function CountLines(ByVal strFilePath As String) As Integer
Dim fileFile As Integer
Dim intLinesReadCount As Integer
intLinesReadCount = 0
fileFile = FreeFile
If (File_Exists(strFilePath)) Then
Open strFilePath For Input As fileFile
Else
`El fichero no existe
MsgBox `El fichero: ` & strFilePath & _
` no ha sido descargado. El proceso se abortara.`, _
MB_OK, `El fichero no existe`
Count_Lines_In_File = -1
Exit Function
End If
Dim strBuffer As String
Do While Not EOF(fileFile)
`Lee una linea
Input #fileFile, strBuffer
`Cuenta
intLinesReadCount = intLinesReadCount + 1
Loop
`Cierra el fichero
Close fileFile
Count_Lines_In_File = intLinesReadCount
End Function
Function File_Exists(strFilePath As String)
If Dir(strFilePath, vbNormal + vbHidden + vbSystem + vbReadOnly) = `` Then
File_Exists = False
Else
File_Exists = True
End If
End Function
|