Hi,
Sorry if this seems a bit of a stupid question, I'v not used Visual basic in a long time.
But can somebody help me out, I need to open a text file from the internet into a textbox, however I dont want to download the file, Only open it, Can someone help
Thanks
Loading text file from Internet
Started by Blimp, Mar 25 2010 10:37 AM
11 replies to this topic
#1
Posted 25 March 2010 - 10:37 AM
|
|
|
#2
Posted 25 March 2010 - 12:03 PM
All things taken from the internet is downloaded first, but the thing you probably want to use is a Net.Webclient and using its DownloadString function. :)
#3
Posted 25 March 2010 - 11:30 PM
Okay,
But I was thinking more like how it is opened when opening files from your filesystem.
like my.computer.filesystem.filexists("C:\example.txt") and so on.
But I was thinking more like how it is opened when opening files from your filesystem.
like my.computer.filesystem.filexists("C:\example.txt") and so on.
#4
Posted 26 March 2010 - 01:09 AM
this:
The thing I said before will give you a string containing the source of the page-
my.computer.filesystem.filexists("C:\example.txt")
won't open a file, so I don't really get what you mean. The thing I said before will give you a string containing the source of the page-
#5
Posted 27 March 2010 - 12:43 AM
Okay, Basically I want to do how you open a picture from the internet like this
picture1.picturelocation = ("http://randomsite.com/randomimage.jpg")
but for a text file, something like thistextbox1.filelocation = ("Http://randomsite.com/randomtext.txt
#6
Posted 27 March 2010 - 02:35 AM
i think use a textreader
TextReader Class (System.IO)
read the text from the URL , then cast that to a string , then assign it like this
TextReader Class (System.IO)
read the text from the URL , then cast that to a string , then assign it like this
TextBox1.Text = (string) Textreadfrom URL;
#7
Posted 27 March 2010 - 02:49 AM
For the textbox thing you can just do the thing with the webclient and downloadstring as I said before.
For the image thingy you can use the downloaddata function to get a byte array and then convert it to an image, I found how to do it here(Windows Developer Blog: Convert image to byte array and vice versa) and I've tested it and it works like a charm.
For the image thingy you can use the downloaddata function to get a byte array and then convert it to an image, I found how to do it here(Windows Developer Blog: Convert image to byte array and vice versa) and I've tested it and it works like a charm.
#8
Posted 27 March 2010 - 04:52 AM
Vswe,
I do not want to download the files, I simply want to access the data without downloading it.
Any way of doing that?
I do not want to download the files, I simply want to access the data without downloading it.
Any way of doing that?
#9
Posted 28 March 2010 - 09:52 AM
To access data from the internet, on your computer... it HAS to be downloaded. Even webpages, when you view them are technically downloaded, even be it temporarily. So in theory, you need to download the text file, then open and read it.
That's just how it works. But for how your program actually works, you wont tell the difference.
That's just how it works. But for how your program actually works, you wont tell the difference.
#10
Posted 10 April 2010 - 07:45 PM
#11
Posted 11 April 2010 - 02:30 AM
Blimp said:
Vswe,
I do not want to download the files, I simply want to access the data without downloading it.
Any way of doing that?
I do not want to download the files, I simply want to access the data without downloading it.
Any way of doing that?
Nope, so1i have explained why.
#12
Posted 11 April 2010 - 11:43 PM
I stand by my beliefs: this thread is full of Awesome!
imacooknotachef.com
Food/Photo Blog
Food/Photo Blog


Sign In
Create Account



Back to top









