Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Streamwriter

Streamwriter

Scheduled Pinned Locked Moved Visual Basic
helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mehmetned
    wrote on last edited by
    #1

    Dim objStreamWriter2 As StreamWriter
    Dim DTString As String

        DTString = "C:\\ETCLINK\\" + Convert.ToString(Date.Now)
    
    
        'Pass the file path and the file name to the StreamWriter constructor.
    
        objStreamWriter2 = New StreamWriter(DTString) 
    

    I take a runtime error when the code is run. What is the problem? Thank you? (objStreamWriter2 = New StreamWriter("C:\ETCLINK\09042008121212.txt") no problem here

    C S 2 Replies Last reply
    0
    • M mehmetned

      Dim objStreamWriter2 As StreamWriter
      Dim DTString As String

          DTString = "C:\\ETCLINK\\" + Convert.ToString(Date.Now)
      
      
          'Pass the file path and the file name to the StreamWriter constructor.
      
          objStreamWriter2 = New StreamWriter(DTString) 
      

      I take a runtime error when the code is run. What is the problem? Thank you? (objStreamWriter2 = New StreamWriter("C:\ETCLINK\09042008121212.txt") no problem here

      C Offline
      C Offline
      Chinners
      wrote on last edited by
      #2

      Hmm. Check out "DTString". When run it could be set to: C:\ETCLINK\2001-01-01 11:11 This isnt a valid filename... The colon symbol ( : ) is a bad char.

      1 Reply Last reply
      0
      • M mehmetned

        Dim objStreamWriter2 As StreamWriter
        Dim DTString As String

            DTString = "C:\\ETCLINK\\" + Convert.ToString(Date.Now)
        
        
            'Pass the file path and the file name to the StreamWriter constructor.
        
            objStreamWriter2 = New StreamWriter(DTString) 
        

        I take a runtime error when the code is run. What is the problem? Thank you? (objStreamWriter2 = New StreamWriter("C:\ETCLINK\09042008121212.txt") no problem here

        S Offline
        S Offline
        Steven J Jowett
        wrote on last edited by
        #3

        I would concur with the other reply, although if you actually gave us the error message, we could provide a better answer. If the problem is the resulting string from Date.Now, use the Format command to get the resulting string into the desired format.

        Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups