J
jbeteta
Hello,
I have a problem declaring variables. I need to create an object oRpte
as ReportClass on WebForm1.aspx and be able to use its value on
WebForm2.aspx.
For declaring the property oRpte() on WebForm1.aspx, I use "Public
Property" and I declare variable _oRpte as Friend Shared. That's my
problem. If I don't declare _oRpte as Friend Shared, I can't use
WebForm1.oRpte() on other webpage. If I declare _oRpte as Friend
Shared, I can use WebForm1.oRpte() with its old value, but if there
are two users navigating WebPage2.aspx at the same time, then
WebForm1.oRpte() can get different values, I can't keep the same value
of WebForm1.oRpte() for both users.
How should I declare the variables, please?
Public Class WebForm1.aspx
Inherits System.Web.UI.Page
Friend Shared _oRpte As ReportClass
......
' more code
......
Private Sub MyFunction()
Dim oRpt As New MyCrystalReport
oRpt.SetDataSource(MydataTable)
Me.oRpte = oRpt
End Sub
Public Property oRpte() As ReportClass
Get
Return _oRpte
End Get
Set(ByVal strValor1 As ReportClass)
_oRpte = strValor1
End Set
End Property
End Class
On WebForm2.aspx, I try to use object oRpte of WebForm1.aspx, but no
success:
Dim oRptx As New ReportClass
Dim wform As New WebForm1
oRptx = wform.oRpte
' I get error here:
oRptx.SetParameterValue("param1", strMessageOnRapport)
'I can't call oRptx
Should I declare like:
Protected Shared _oRpte As ReportClass
instead of
Friend Shared _oRpte As ReportClass
??
I have a problem declaring variables. I need to create an object oRpte
as ReportClass on WebForm1.aspx and be able to use its value on
WebForm2.aspx.
For declaring the property oRpte() on WebForm1.aspx, I use "Public
Property" and I declare variable _oRpte as Friend Shared. That's my
problem. If I don't declare _oRpte as Friend Shared, I can't use
WebForm1.oRpte() on other webpage. If I declare _oRpte as Friend
Shared, I can use WebForm1.oRpte() with its old value, but if there
are two users navigating WebPage2.aspx at the same time, then
WebForm1.oRpte() can get different values, I can't keep the same value
of WebForm1.oRpte() for both users.
How should I declare the variables, please?
Public Class WebForm1.aspx
Inherits System.Web.UI.Page
Friend Shared _oRpte As ReportClass
......
' more code
......
Private Sub MyFunction()
Dim oRpt As New MyCrystalReport
oRpt.SetDataSource(MydataTable)
Me.oRpte = oRpt
End Sub
Public Property oRpte() As ReportClass
Get
Return _oRpte
End Get
Set(ByVal strValor1 As ReportClass)
_oRpte = strValor1
End Set
End Property
End Class
On WebForm2.aspx, I try to use object oRpte of WebForm1.aspx, but no
success:
Dim oRptx As New ReportClass
Dim wform As New WebForm1
oRptx = wform.oRpte
' I get error here:
oRptx.SetParameterValue("param1", strMessageOnRapport)
'I can't call oRptx
Should I declare like:
Protected Shared _oRpte As ReportClass
instead of
Friend Shared _oRpte As ReportClass
??