473,473 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

asp and global variables

Hi

My first vb.net/asp.net application is taking shape now and I have started
using session state to store user variables or type string, long and bool..
The VB6 app I am converting also makes great use of global variables as per
the example below

Structure Gen_setup

Dim Nominal As Long

Dim TaxCode As Integer

Dim VATNo As String

End Structure

Public setups As Gen_setup

I want to convert this to session state, can anyone show me the best way.

Thanks in advance.


---
Outgoing mail is certified Virus Free, so am I.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.677 / Virus Database: 439 - Release Date: 04/05/2004
Nov 18 '05 #1
2 1379
I think this is what you are after.

public structure Gen_setup
Dim Nominal As Long
Dim TaxCode As Integer
Dim VATNo As String
Public Sub New(pNominal as long, pTaxCode as Integer, pVATNo as String)
Me.Nominal = pNominal
Me.TaxCode = pTaxCode
Me.VATNo = pVATNo
End Sub
end structure
Session["mySessionVar"] = new Gen_setup(21,6,"some string here")

"starbuck" <st******@mbssoft.co.uk> wrote in message news:uQ**************@tk2msftngp13.phx.gbl...
Hi

My first vb.net/asp.net application is taking shape now and I have started
using session state to store user variables or type string, long and bool..
The VB6 app I am converting also makes great use of global variables as per
the example below

Structure Gen_setup

Dim Nominal As Long

Dim TaxCode As Integer

Dim VATNo As String



End Structure

Public setups As Gen_setup

I want to convert this to session state, can anyone show me the best way.

Thanks in advance.




---
Outgoing mail is certified Virus Free, so am I.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.677 / Virus Database: 439 - Release Date: 04/05/2004

Nov 18 '05 #2
You may want to add this attribute in case you ever use out of process session state (StateServer).
Then you classes and structures need to be serializable. May as well build it in up front.

<Serializable>_
public structure Gen_setup

--
Joe Fallon


"Darren Clark" <dc******@hotmail.com> wrote in message news:O6*************@TK2MSFTNGP10.phx.gbl...
I think this is what you are after.

public structure Gen_setup
Dim Nominal As Long
Dim TaxCode As Integer
Dim VATNo As String
Public Sub New(pNominal as long, pTaxCode as Integer, pVATNo as String)
Me.Nominal = pNominal
Me.TaxCode = pTaxCode
Me.VATNo = pVATNo
End Sub
end structure
Session["mySessionVar"] = new Gen_setup(21,6,"some string here")

"starbuck" <st******@mbssoft.co.uk> wrote in message news:uQ**************@tk2msftngp13.phx.gbl...
Hi

My first vb.net/asp.net application is taking shape now and I have started
using session state to store user variables or type string, long and bool..
The VB6 app I am converting also makes great use of global variables as per
the example below

Structure Gen_setup

Dim Nominal As Long

Dim TaxCode As Integer

Dim VATNo As String



End Structure

Public setups As Gen_setup

I want to convert this to session state, can anyone show me the best way.

Thanks in advance.




---
Outgoing mail is certified Virus Free, so am I.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.677 / Virus Database: 439 - Release Date: 04/05/2004

Nov 18 '05 #3

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

Similar topics

10
by: Matt | last post by:
Greetings, What are people's thoughts on global variables in C++? Why are we taught not to use them in programming? Is it true that if you are running two copies of the C program one copy can...
4
by: Andrew V. Romero | last post by:
I have been working on a function which makes it easier for me to pull variables from the URL. So far I have: <script language="JavaScript"> var variablesInUrl; var vArray = new Array(); ...
12
by: David WOO | last post by:
Hi, I am a newbie on C++, I need to define some global variables which should be accessible to most classes. In the mean time, I don't won't the global variables be modified freely at most of...
2
by: Bryan Parkoff | last post by:
….I would like to know which is the best optimization to use global variable or global struct. I always tell C/C++ Compiler to turn on optimization. ….I use underscore between first name and...
17
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm...
33
by: MLH | last post by:
I've read some posts indicating that having tons of GV's in an Access app is a bad idea. Personally, I love GVs and I use them (possibly abuse them) all the time for everything imaginable - have...
9
by: CDMAPoster | last post by:
About a year ago there was a thread about the use of global variables in A97: http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157 Best Practices by Kang...
5
by: Sandman | last post by:
I dont think I understand them. I've read the section on scope in the manual inside out. I'm running PHP 5.2.0 Here is the code I'm working on: //include_me.php <?php $MYVAR = array(); global...
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.