Mi consulta es la siguiente, tengo un código que me muestra en un textbox el contenido de un archivo.txt que esta en mi pc, mi pregunta es.
Como podría hacer lo mismo con un archivo de texto que esta en un servidor ?
El codigo es este:
Private Sub Form_load()
Dim linea As String
Dim c As String
' Muestra en textbox el contenido de archivo local version.txt
Open "c:/version.txt" For Input As #1
linea = ""
Me.Text4.Text = ""
While Not EOF(1)
c = Input(1, #1)
If c = "," Then
Me.Text4.Text = Me.Text4.Text + linea + vbNewLine
linea = ""
Else
linea = linea + c
End If
Wend
If linea <> "" Then Me.Text4.Text = Me.Text4.Text + linea
Close #1
' Muestra en textbox el contenido de archivo version.txt desde servidor
Open "http://miweb/updatepatch/version.txt" For Input As #1
linea = ""
Me.Text3.Text = ""
While Not EOF(1)
c = Input(1, #1)
If c = "," Then
Me.Text3.Text = Me.Text3.Text + linea + vbNewLine
linea = ""
Else
linea = linea + c
End If
Wend
If linea <> "" Then Me.Text3.Text = Me.Text3.Text + linea
Close #1
End Sub
Así se ve en mi programa:
(http://i55.servimg.com/u/f55/14/27/29/04/se_ve10.png)
Muchas, pero muchas gracias por la paciencia :D
Enviado desde mi GT-I9300 usando Tapatalk
Podrías hacer algo como esto
Private Sub Form_Load()
Dim Msxml2 As Object
Set Msxml2 = CreateObject("Msxml2.XMLHTTP.3.0")
Msxml2.open "GET", "http://www.autoitscript.com/autoit3/docs/autoit_changelog_complete.txt", False
Msxml2.send
Text1.Text = Msxml2.responseText
End Sub
Saludos
Cita de: Danyfirex en 19 Octubre 2013, 03:56 AM
Podrías hacer algo como esto
Private Sub Form_Load()
Dim Msxml2 As Object
Set Msxml2 = CreateObject("Msxml2.XMLHTTP.3.0")
Msxml2.open "GET", "http://www.autoitscript.com/autoit3/docs/autoit_changelog_complete.txt", False
Msxml2.send
Text1.Text = Msxml2.responseText
End Sub
Saludos
Me funciono perfecto, el problema es que al cambiar el contenido del archivo en el servidor, no cambia en el textbox, sigue mostrando el anterior :S
Es como si descargara el archivo y después tomara los datos de ahí y no del servidor.
Muchas gracias :D ;-)
Debería funciona al llamar la función otra vez.
Tienes toda la razon ;-) :xD
muchas gracias tema resuelto :D
Cita de: Danyfirex en 19 Octubre 2013, 03:56 AM
Podrías hacer algo como esto
Private Sub Form_Load()
Dim Msxml2 As Object
Set Msxml2 = CreateObject("Msxml2.XMLHTTP.3.0")
Msxml2.open "GET", "http://www.autoitscript.com/autoit3/docs/autoit_changelog_complete.txt", False
Msxml2.send
Text1.Text = Msxml2.responseText
End Sub
Saludos
No me sirve :'(
asi lo tengo
Private Sub Form_Load()
Dim Msxml2 As Object
Msxml2 = CreateObject("Msxml2.XMLHTTP.3.0")
Msxml2.open("GET", "http://localhost/versionf.txt", False)
Msxml2.send()
Text1.Text = Msxml2.responseText
Tambien tengo el textbox
llamado text1
(http://masterlolohosting.tk/images/txtbox.png)
(http://masterlolohosting.tk/images/form1.png)
q tengo mal?
uso vb 2008
Que error te da?
tal vez así:
Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString("http://localhost/versionf.txt")
Text1.Text=result
Saludos
Cita de: Danyfirex en 23 Octubre 2013, 18:12 PM
Que error te da?
tal vez así:
Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString("http://localhost/versionf.txt")
Text1.Text=result
Saludos
gracias por responder tan rapido
no no me da error
pero no se muestra nada en el textbox
(http://masterlolohosting.tk/images/nada.png)
Coloca el textbox en multilinea.
Saludos
Yo tampoco pude, asi que envés de textbox use un control webbrowser, si te interesa, te doy el código amigo
Cita de: rapbyone en 24 Octubre 2013, 00:58 AM
Yo tampoco pude, asi que envés de textbox use un control webbrowser, si te interesa, te doy el código amigo
A mi me funciona de las dos formas que te coloqué.
No gracias no necesito el código.