File System Object

Discussion in 'ASP .Net' started by Vicky S, Jul 14, 2003.

  1. Vicky S

    Vicky S Guest

    Hello,
    I'm new to dot net and I can't seem to find the object name that is
    equivalent to Scripting.FileSystemObject. Can anyone help?

    Thanks,
    V
     
    Vicky S, Jul 14, 2003
    #1
    1. Advertising

  2. Vicky S

    Vicky S Guest

    and also.. for the functions right(string, len_returned) and left(string,
    len_returned)

    "Vicky S" <> wrote in message
    news:%...
    >
    > Hello,
    > I'm new to dot net and I can't seem to find the object name that is
    > equivalent to Scripting.FileSystemObject. Can anyone help?
    >
    > Thanks,
    > V
    >
    >
     
    Vicky S, Jul 14, 2003
    #2
    1. Advertising

  3. Take a look at System.IO

    "Vicky S" <> wrote in message
    news:#...
    >
    > Hello,
    > I'm new to dot net and I can't seem to find the object name that is
    > equivalent to Scripting.FileSystemObject. Can anyone help?
    >
    > Thanks,
    > V
    >
    >
     
    Juliano Bortolozzi, Jul 14, 2003
    #3
  4. Vicky S

    Vicky S Guest

    Thanks,
    I can now generate a file.. but for some reason, it's not writing to it..
    what am I doing wrong?

    Dim oFile As System.IO.File, oStream As System.IO.StreamWriter

    Dim filename As String

    filename = Application.ExecutablePath & "\..\importlog.txt"

    oStream = oFile.CreateText(filename)

    oStream.WriteLine(Now() & " " & strMessage)



    "Juliano Bortolozzi" <> wrote in message
    news:...
    > Take a look at System.IO
    >
    > "Vicky S" <> wrote in message
    > news:#...
    > >
    > > Hello,
    > > I'm new to dot net and I can't seem to find the object name that is
    > > equivalent to Scripting.FileSystemObject. Can anyone help?
    > >
    > > Thanks,
    > > V
    > >
    > >

    >
    >
     
    Vicky S, Jul 14, 2003
    #4
  5. In your example you just have to call the Close method of the stream object.

    But, to do what you want, I'd consider a different approach:

    Dim stream As System.IO.StreamWriter

    Try

    stream = New System.IO.StreamWriter("c:\temp\test.txt", True)

    stream.Write("test")

    Finally

    If Not stream Is Nothing Then

    stream.Close()

    End If

    End Try


    Note that you can't forget to close the stream, even if an exception has
    occured.

    "Vicky S" <> wrote in message
    news:#...
    >
    > Thanks,
    > I can now generate a file.. but for some reason, it's not writing to it..
    > what am I doing wrong?
    >
    > Dim oFile As System.IO.File, oStream As System.IO.StreamWriter
    >
    > Dim filename As String
    >
    > filename = Application.ExecutablePath & "\..\importlog.txt"
    >
    > oStream = oFile.CreateText(filename)
    >
    > oStream.WriteLine(Now() & " " & strMessage)
    >
    >
    >
    > "Juliano Bortolozzi" <> wrote in message
    > news:...
    > > Take a look at System.IO
    > >
    > > "Vicky S" <> wrote in message
    > > news:#...
    > > >
    > > > Hello,
    > > > I'm new to dot net and I can't seem to find the object name that is
    > > > equivalent to Scripting.FileSystemObject. Can anyone help?
    > > >
    > > > Thanks,
    > > > V
    > > >
    > > >

    > >
    > >

    >
    >
     
    Juliano Bortolozzi, Jul 14, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathy Burke
    Replies:
    2
    Views:
    5,208
    Kevin Spencer
    Aug 1, 2003
  2. Showjumper
    Replies:
    2
    Views:
    1,858
    Showjumper
    Aug 2, 2003
  3. Imran Aziz
    Replies:
    4
    Views:
    8,862
    ljenner01
    Jan 19, 2011
  4. keithb
    Replies:
    3
    Views:
    19,051
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    May 7, 2006
  5. Replies:
    0
    Views:
    918
Loading...

Share This Page