Results 1 to 20 of 20

Thread: [2008] MonthCalendar help

Threaded View

  1. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [2008] MonthCalendar help

    Hey,

    Again, there are various ways to do this, and it depends on what you are trying to do, but as a rough guide, this is what you would need to do:

    1. Create a FileStream object and either create a new file, or open an existing one.
    2. Create a StreamWriter to wrap around the FileStream
    3. Use the methods of the StreamWriter to write the information to the file.
    4. Once you are done, close the StreamWriter, and then close the FileStream.

    Code:
    Dim theFile As FileStream = File.Create("C:\somefile.txt")
    Dim writer As StreamWriter = New StreamWriter(theFile)
    writer.WriteLine("Hello")
    writer.Close()
    theFile.Close()
    It is possible to bypass the need for a FileStream object by simply calling the CreateText method on the File object, which returns a StreamWriter.

    Code:
    Dim writer As StreamWriter = File.CreateText("c:\somefile.txt")
    writer.WriteLine("Hello")
    writer.Close()
    Or you can write directly to a file using the WriteAllText method.

    Code:
    File.WriteAllText("c:\somefile.txt", "Hello")
    Hope that helps!!

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width