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

Home Posts Topics Members FAQ

Code question

TCB
I have coded a page something like this (this page contains a Wizard
control):

Private shared p_MyInt as Integer

Sub Page_Load(.....)

If Not(me.ispostback) then
p_MyInt = Request.QueryString("SomeInt")
End If
.... some other stuff

End Sub

At the end of the wizard....

Sub SaveData()

'Calls a class that stores the data
StoreData(p_MyInt,etc,etc,etc)
Response.Redirect("AppResult.aspx")

End Sub

Somehow when StoreData is called, the value of p_MyInt is completelly
different of what it should be, what can cause this change in values?

Thank you all!

Mar 13 '06 #1
1 893
You only have one instance of this variable for every user of your system.
So if I am filling out form 1 but you are on form 3, one of us can overwrite
this variable, and our data will be saved for form 3, when only one of us is
on it.

You should not be using shared variables for user specific information.

"TCB" <tc******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have coded a page something like this (this page contains a Wizard
control):

Private shared p_MyInt as Integer

Sub Page_Load(.....)

If Not(me.ispostback) then
p_MyInt = Request.QueryString("SomeInt")
End If
... some other stuff

End Sub

At the end of the wizard....

Sub SaveData()

'Calls a class that stores the data
StoreData(p_MyInt,etc,etc,etc)
Response.Redirect("AppResult.aspx")

End Sub

Somehow when StoreData is called, the value of p_MyInt is completelly
different of what it should be, what can cause this change in values?

Thank you all!

Mar 13 '06 #2

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

Similar topics

3
5182
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers using check boxes. For example, a question such as
70
2521
by: grün | last post by:
The MSDN techdocs are somewhat limited on this and I wanted more information. Is there any resource that says definitively which is faster /O2 or /Ox and by how much?
19
1732
by: Rhek | last post by:
Hello, I would like to apologize for double posting this question because I posted this same question in what looks like the VB 6 newgroups and not the .Net newsgroup... Here goes: The code below works but I just keep looking at it and thinking that there should be some way to compact it. There are 10 ImagePages and the only difference...
67
4193
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. Unfortunately these ad hominem rhetorts are frequently introduced into purely technical discussions on the feasibility of supporting such functionality in C++....
34
7273
by: Mark Kamoski | last post by:
Hi-- Please help. I need a code sample for bubble sort. Thank you. --Mark
171
7596
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles) like it because you can split the code from the design. That is logical. But if you are the only one working on the code, it seem a little...
17
2674
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but know nothing about ASP. He can build the design of the pages in HTML with tables, labels, textboxes etc. But then I would need to change them to...
2
5061
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly...
4
68117
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer must be embedded somewhere in the source code, and I would like to know if anyone knows where to find the correct answer. I would greatly...
8
1233
by: Andy B | last post by:
Before I do a no no on a newsgroup, I need to ask a question: What is the max number of lines of code you can/should post here before it gets too long?
0
7397
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7563
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7125
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7543
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5102
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4757
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3252
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.