T
tshad
I just put this together from O'Reillys book (with much of the code stripped
out).
Global.asax:
******************************************
<%@ Application Language="VB" %>
<script runat="server">
public shared sub WriteFile(strText as string)
response.write("<br>inside WriteFile strText = " & strText & "<br>")
end sub
</script>
******************************************
testglobal.aspx
******************************************
<%@ Page Language="VB" debug="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script runat="server">
sub Page_Load(sender as Object, e as EventArgs)
Global.WriteFile("This is a test")
end sub
<html>
<body>
</body>
</html>
******************************************
It is obviously calling sub, but I don't understand the error:
************************************************************
Compiler Error Message: BC30369: Cannot refer to an instance member of a
class from within a shared method or shared member initializer without an
explicit instance of the class.
Source Error:
Line 4:
Line 5: public shared sub WriteFile(strText as string)
Line 6: response.write("<br>inside WriteFile strText = " & strText &
"<br>")
Line 7: end sub
Line 8:
***********************************************************************
Is it the response.write that is causing the error?
Thanks,
Tom
out).
Global.asax:
******************************************
<%@ Application Language="VB" %>
<script runat="server">
public shared sub WriteFile(strText as string)
response.write("<br>inside WriteFile strText = " & strText & "<br>")
end sub
</script>
******************************************
testglobal.aspx
******************************************
<%@ Page Language="VB" debug="true" ContentType="text/html"
ResponseEncoding="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script runat="server">
sub Page_Load(sender as Object, e as EventArgs)
Global.WriteFile("This is a test")
end sub
<html>
<body>
</body>
</html>
******************************************
It is obviously calling sub, but I don't understand the error:
************************************************************
Compiler Error Message: BC30369: Cannot refer to an instance member of a
class from within a shared method or shared member initializer without an
explicit instance of the class.
Source Error:
Line 4:
Line 5: public shared sub WriteFile(strText as string)
Line 6: response.write("<br>inside WriteFile strText = " & strText &
"<br>")
Line 7: end sub
Line 8:
***********************************************************************
Is it the response.write that is causing the error?
Thanks,
Tom