Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
February 09, 2012, 11:16:09 AM

Pages: [1]   Go Down
  Print  
Author Topic: 'Open' is not a member of 'String'  (Read 3671 times)
Dug
Pong! (the videogame) Master
*****
Offline Offline

Posts: 26


« on: May 05, 2009, 08: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:

'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, 08:41:11 AM by Dug » Logged
Pages: [1]   Go Up
  Print  
 
Jump to: