M
Mr Ideas Man
Hi all,
I am trying to create the following class:
My problem is i can't seem to use this static function (VB)
The error i am getting is "methods can not be declared static"
Can anyone enlighten me?
Imports System.IO
Public Class Stationery : Inherits Page
Public Static Function GetStationery(ByVal strFileName)
Dim objStreamReader As StreamReader
Dim strFileContents As String
Try
'open file
objStreamReader = File.OpenText(strFileName)
'read the entire file into a string
strFileContents = objStreamReader.ReadToEnd()
'close file
objStreamReader.Close()
Catch ex As Exception
'output exception error
Response.Write(("The following exception occurred: " +
ex.ToString()))
End Try
'return file contents string
GetStationery = strFileContents
End Function
End Class
I am trying to create the following class:
My problem is i can't seem to use this static function (VB)
The error i am getting is "methods can not be declared static"
Can anyone enlighten me?
Imports System.IO
Public Class Stationery : Inherits Page
Public Static Function GetStationery(ByVal strFileName)
Dim objStreamReader As StreamReader
Dim strFileContents As String
Try
'open file
objStreamReader = File.OpenText(strFileName)
'read the entire file into a string
strFileContents = objStreamReader.ReadToEnd()
'close file
objStreamReader.Close()
Catch ex As Exception
'output exception error
Response.Write(("The following exception occurred: " +
ex.ToString()))
End Try
'return file contents string
GetStationery = strFileContents
End Function
End Class