Results 1 to 2 of 2

Thread: writing to a txt file, then opening and reading

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    1

    Question writing to a txt file, then opening and reading

    hi, below is some code i'm using, everything works and "MsgBox base64Str" prompts the correct value, but instead of MsgBox, i'm trying to create a text file, write the values of base64Str to the file, then open it for reading, this is what i have so far (after the MsgBox base64Str)
    thanks:

    VB Code:
    1. ' Base64 ActiveX creation:
    2. set obj = CreateObject("Base64.Base64")
    3.  
    4. ' Load a GIF image file into memory.
    5. binaryData = obj.LoadBinaryFile("Prem.gif")
    6.  
    7. ' Convert the binary data to a base64 string
    8. base64Str = obj.ToBase64(binaryData)
    9.  
    10. ' Display the base-64 string.
    11.  
    12. MsgBox base64Str
    13.  
    14. Dim oFile as System.IO.File
    15. Dim oWrite as System.IO.StreamWriter
    16. oWrite = oFile.CreateText(“C:\basecoder64\test.txt”)
    17. oWrite.WriteLine(base64Str)
    18. ooWrite.Close()
    19.  
    20.  
    21. Dim EntireFile as String
    22. oRead = oFile.OpenText(“C:\basecoder64\test.txt”)
    23. EntireFile = oRead.ReadToEnd()
    24.  
    25.  
    26. OpenText

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: writing to a txt file, then opening and reading

    Erm, this is VB.NET. I've never really liked the way .NET requires FileStream readers/writers. That format doesn't belong in VB IMO

    Posting this in the .NET forum will turn up more help..

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

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