That's not correct.
You can use server.transfer as your code is beginning to. The next step is
to recreate the first page on the second. You will need to do a CType on the
context object that is passed using server.transfer.
Dim Page1 As Page1 = CType(Context, Page1)
The important thing is that if you can arrive at a page2 from more pages
than page1 this code will error out if you try to make say, page3, into
page1.
I have some sample code in the code library on my website,
www.aboutfortunate.com for determining which page a context object came
from. Just search for: "get page name".
I hope this helps.
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:ee**************@TK2MSFTNGP11.phx.gbl...
You can't. Once the webform1 finishes execution, it ceases to exist.
You will have to store the value in session or pass it in the query
string, or place it elsewhere where both forms can access to it.
"Tor Inge Rislaa" <to*************@rislaa.no> wrote in message
news:e5**************@TK2MSFTNGP12.phx.gbl... How to refer to a variable on another webform
Hi, I have a Webform1 with a public variable that is assigned a value
before my Webform2 is displayed. In the Page_Load procedure of Webform2 I want
to evaluate the value of the variable of Webform1.
Code on Webform1
Public MyVar1 As Integer
Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.ServerClick
MyVar1 = 1
Server.Transfer("Webform2.aspx")
End Sub
Code on Webform2
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Myvar2 As Integer
Myvar2 = (Myvar1 from Webform1... Any Ideas?)
End Sub
T I Rislaa