Global Variables
I have a variable defined as public StrCompare as string This is defined at the page level. I set the value of this in the routine that gets processed on the first button click. On the second button click I check the value but the variable is empty. I know it is getting set correctly because I have a label where I am displaying it from the variable. What am I doing wrong that I can't use this variable anywhere in the program?
The second problem is that I want to check this variable to see if it contains a quote '
I have tried if StrCompare = """ and other variations but none work. How do I check a variable to see if it contains an actual quote?
Thanks
[704 byte] By [
flitt2001] at [2007-11-11 8:15:52]

# 1 Re: Global Variables
Remember that data is essentially stateless in server side processing environments such as ASP and ASP.NET. There are several methods for persisting data between postbacks. Two of the most common methods are Session variables and Cookies. You can also use ViewState in ASP.NET.
http://samples.gotdotnet.com/quickstart/aspplus/doc/stateoverview.aspx
If you need to search for a specific character pattern in a string use the IndexOf (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemstringclassindexoftopic.asp) method.
# 3 Re: Global Variables
Dim CharPos As Integer
'Either of the following should work:
CharPos = StrCompare .IndexOf("'")
CharPos = StrCompare .IndexOf(Chr(39))