M
msch-prv
Sorry for this trivial question: I am a newbie...
I have difficulties calling up a class poperty.
Situation: I would like to move the following (sample) function from
global.asax to a custom class (MyClass). The following works fine in an
aspx file:
global.asax:
Public Shared Function SayHello(strName as string) As String
Return "Hello, " & strName
End Function
aspx file:
Dim strHello as string = global_asax.SayHello("John")
Question: How do I proceed with classes? In class MyClass, I have:
Imports Microsoft.VisualBasic
Namespace MyClass.Misc
Public Class StrUtil
Public ReadOnly Property SayHello(strName as string) As String
Return "Hello, " & strName
End Property
End Class
End Namespace
How can I call up SayHello() in an aspx script? The error 'variable
used before it has been assigned a value' shows up with the following
code:
<%@ Import Namespace="MyClass.Misc"%>
....
Dim objStrUtil as StrUtil
Response.Write("Msg: " & objStrUtil.SayHello("John"))
Thanks for any hints, Mark
I have difficulties calling up a class poperty.
Situation: I would like to move the following (sample) function from
global.asax to a custom class (MyClass). The following works fine in an
aspx file:
global.asax:
Public Shared Function SayHello(strName as string) As String
Return "Hello, " & strName
End Function
aspx file:
Dim strHello as string = global_asax.SayHello("John")
Question: How do I proceed with classes? In class MyClass, I have:
Imports Microsoft.VisualBasic
Namespace MyClass.Misc
Public Class StrUtil
Public ReadOnly Property SayHello(strName as string) As String
Return "Hello, " & strName
End Property
End Class
End Namespace
How can I call up SayHello() in an aspx script? The error 'variable
used before it has been assigned a value' shows up with the following
code:
<%@ Import Namespace="MyClass.Misc"%>
....
Dim objStrUtil as StrUtil
Response.Write("Msg: " & objStrUtil.SayHello("John"))
Thanks for any hints, Mark