Oppure

Loading
19/07/11 15:00
Hackaos
Ragazzi ho un problema, in poche parole devo visualizzare un file .txt in una textbox. Il codice l'ho fatto e funziona:

 
Dim filetxt As String
filetxt = "File.txt"
Open filetxt For Input As #1
Do Until EOF(1)
Input #1, data
Text1.Text = Text1.Text + data + vbNewLine
EOF (1)
Loop
Close #1


IL CODICE FUNZIONA, INFATTI APRENDO UN NORMALE FILE TXT VIENE RIPORTATO NELLA TEXT1.TEXT MA QUANDO PROVO AD APRIRE UN FILE.TXT MOLTO PIù GRANDE MI ESCE QUESTO ERRORE "Run-Time Error 13: Type Mismatch". COME POSSO RISOLVERE????????????:(:(
aaa
19/07/11 15:04
HeDo
usando un altro metodo di input, ma sinceramente programmare in vb6 nel 2011 ha veramente ben poco senso.

studia vb.net e ti si aprirà un mondo, questi problemi non esistono neanche lontanamente.
aaa
19/07/11 18:29
nessuno
Ma a cosa serve la linea 7 ?
Ricorda che nessuno è obbligato a risponderti e che nessuno è perfetto ...
---
Il grande studioso italiano Bruno de Finetti ( uno dei padri fondatori del moderno Calcolo delle probabilità ) chiamava il gioco del Lotto Tassa sulla stupidità.
19/07/11 18:43
gibra
Hackaos, il tuo codice ha qualche pecca. :D
Ti passo una funzione che uso io per aprire i file di testo in un colpo solo:

Function FileText(ByVal filename As String) As String
    Dim handle As Integer    
    ' ensure that the file exists
    If Len(Dir$(filename)) = 0 Then
        Err.Raise 53   ' File not found
    End If
    
    ' open in binary mode
    handle = FreeFile
    Open filename$ For Binary As #handle
    ' read the string and close the file
    FileText = Space$(LOF(handle))
    Get #handle, , FileText
    Close #handle
End Function


La usi semplicemente così:

Text1.Text = FileText("C:\temp\prova.txt)

:)
aaa