473,513 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to pass a variable from one file to another?

Hi,

The first file contains (test1.aspx):
<%@ Page Language="VB" %>
<script runat="server">
Public myvr As String
</script>
<%myvr = "ok"%>

The second file (test2.aspx):
<%@ Page Language="VB" %>
<% Response.Write(myvr)%>

When i run test2.aspx, i get:
"Name 'myvr' is not declared"

How to declare it?
Thanks
Chris

May 11 '06 #1
1 1117
Use cross-page posting...and the PreviousPage properties.

http://msdn2.microsoft.com/en-us/library/ms178139.aspx

You could also use Server.Transfer.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Chris" <cc*@sdsd.dc> wrote in message news:e8**************@TK2MSFTNGP05.phx.gbl...
Hi,

The first file contains (test1.aspx):
<%@ Page Language="VB" %>
<script runat="server">
Public myvr As String
</script>
<%myvr = "ok"%>

The second file (test2.aspx):
<%@ Page Language="VB" %>
<% Response.Write(myvr)%>

When i run test2.aspx, i get:
"Name 'myvr' is not declared"

How to declare it?
Thanks
Chris

May 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7730
by: drec | last post by:
I need to pass a variable from script1.php to script2.php. The problem is that these scripts use frames and therefore I am able to pass the variable through the URL. It also does not use forms to...
28
4673
by: Bill | last post by:
Hello All, I am trying to pass a struct to a function. How would that best be accomplished? Thanks, Bill
3
1819
by: leonardodiserpierodavinci | last post by:
Hi. Sorry for what is perhaps a neophyte question: is it possible to pass a variable to a PHP script from inside another PHP piece of code? For instance, the file test.php (which of course...
12
2997
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope....
12
11008
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7120
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
466
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.