locked
read write text file RRS feed

  • Question

  •  Hi,

    I asked this before and didnt get what I wanted.

    I just want to read in data from a textfile and write to it.

    I add a textfile to the project but do I use  stream reader/writer ?

    I just wanted the syntax to do be able to read/write textfiles this and not how to set up the data

     

    Dim instance As Stream
    Dim buffer As Byte()
    Dim offset As Integer
    Dim count As Integer
    Dim returnValue As Integer

    returnValue = instance.Read(buffer, offset, _
    count)
     or
    Dim instance As StreamReader
     
    how do i open a file and where do i write the path name?
    Do i need to write the URL of the file to open as I am usinf VWD and virtual web server so what do i do? 
    Sunday, December 28, 2008 6:02 PM

Answers

  • You can read in a remote text file using the WebClient. You cannot write to a text file unless you use some sort of a web service or URL to upload it. Typical File IO will not work.

    Silverlight supports writing to isolated storage, but not to arbitrary files at other locations.

    Pete

    Sunday, December 28, 2008 6:36 PM

All replies

  • You can read in a remote text file using the WebClient. You cannot write to a text file unless you use some sort of a web service or URL to upload it. Typical File IO will not work.

    Silverlight supports writing to isolated storage, but not to arbitrary files at other locations.

    Pete

    Sunday, December 28, 2008 6:36 PM
  • what about this example?

    What i want to to load a textfile from my local HD and test on my VWD on my PC. I use virtual server from VWD

     

    I need an example or else i can a lot of frustration happening.

    How about this below? what is the path of root directory?

     http://www.insidercoding.com/post/2008/08/08/Tutorial-Reading-and-Writing-Files-in-Silverlight.aspx

    Sunday, December 28, 2008 11:59 PM
  • I don't know if you ever got an answer, Mexican, but I am having the saving problem as you: a lot of talk and no examples.

    0. I am running SL4, editing all of this in Expression Blend 4.  Under references I have mscorlib.dll, system.dll, System.Core.dll, System.Net.dll, System.Windows.dll, System.Windows.Browser.dll, System.Xml.dll.

    1. I have a textbox named myTextbox.

    2. In my project, I right-clicked on the project name and selected "Add Existing Item..." and added Textfile.txt.  Textfile.txt has one line in it "Hello World".

    3. How do I put the contents of Textfile.txt into myTextbox.text?

    I would appreciate any examples of how to do this.  Truly, I must be using the wrong search terms because nothing works.

    -Ron

    Friday, April 1, 2011 10:28 PM
  • how to read and write text file  in silverlight
    Please check this link

    http://www.mindstick.com/Articles/4791e151-9077-4486-b158-46a223ea9b7e/?Read and Write Text files in Silverlight

    Monday, April 4, 2011 4:44 AM