Lunarpages Web Hosting Forum

Author Topic: 'Open' is not a member of 'String'  (Read 6160 times)

Offline Dug

  • Pong! (the videogame) Master
  • *****
  • Posts: 26
'Open' is not a member of 'String'
« on: May 05, 2009, 07:34:36 AM »
Hi there,

I'm on an ASP.NET 3.5 server.  I keep on getting the error "OpenText is not a member of string". 
I've imported the System.IO namespace. 
I've had this working before on the same server.  Google doesn't seem to have anything to say about this error.  I'd appreciate any help.

Code: [Select]

'Open a file for reading
Dim FILENAME as String = Server.MapPath("Rand.txt")

'Get a StreamReader class that can be used to read the file
Dim objStreamReader as StreamReader
objStreamReader = File.OpenText(FILENAME)

'Now, read the entire file into a string
Dim contents as String = objStreamReader.ReadToEnd()

'Set the text of the file to a Web control
lblRawOutput.Text = contents

'We may wish to replace carraige returns with <br>s
lblNicerOutput.Text = contents.Replace(vbCrLf, "<br>")

objStreamReader.Close()


Thanks

Dug
« Last Edit: May 05, 2009, 07:41:11 AM by Dug »