Why isn't this class working?
I'm using ASP.NET (VB), and I'm trying to use a class to display a custom popup function (alert().
The problem here is that is says I need an explicit instance of a class to use response. (Not sure how to do that...)
Public Class msgClass
Public Shared Sub alert(ByVal msg As String)
Response.Write("<script>alert('" + msg.tostring + "');</script>")
This is how I call it in my main ASPX.vb page:
I've tried using Public Sub, but when it gets there, it tells me that "response..." can't be used like that.
Dim a As New msgClass
Last edited by MdWebtress; 12-07-2004 at 04:20 PM.
Ok, I've gotten it like this:
I can call the Message() sub, but I get the error that: "Response is not available in this context. ". If I put in "Shared sub" I can't use it. ("Can't refer to an instance member of a class from within a shared method....")
Public Class a
Private a As Integer
Private str As String
Public Property setInt() As Integer
Set(ByVal Value As Integer)
a = Value
Public Property setStr() As String
Set(ByVal Value As String)
str = Value
Public Sub Message(ByVal str As String)
Response.Write("<script>alert('" + a.ToString + "');</script>")
Last edited by MdWebtress; 12-08-2004 at 10:30 AM.
What I mean rather, are you importing that namespace on the head of your asp.net page?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)