473,698 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regex not working in page_load

I am trying to get a regular expression to work and I keep getting the
following error:

Compiler Error Message: BC30469: Reference to a non-shared member requires
an object reference.

The page is:

*************** *************** *************** *************** *************** *******
<%@ Page Language="VB" trace="true" debug="true" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitl ed Document</title>
</head>
<script runat="server">
sub page_load(s as object,e as eventargs)
'dim testString as String = "a test"
testLabel.text = "a test"

testLabel.text = Regex.Replace(t estLabel.text," ( and not | and )")
response.write( testLabel.text)
end sub
</script>
<body>
<asp:label id = "testLabel" runat="server"/>
</body>
</html>
*************** *************** *************** *************** *************** ********

I tried it with both testLabel.text (which is an asp:label) and also
testString (string) and got the error with both.

I do exactly the same thing in my other asp pages to make a currency value
into a decimal value.

objCmd.paramete rs.add("@WagesM in",SqlDbType.M oney).value =
Regex.Replace(W agesMin.Text,"\ $|\,","")

This works fine.

What is the difference?

Thanks,

Tom

Nov 19 '05 #1
2 1518
"tshad" <ts**********@f tsolutions.com> wrote in message
news:ue******** ******@TK2MSFTN GP09.phx.gbl...
I am trying to get a regular expression to work and I keep getting the
following error:

Compiler Error Message: BC30469: Reference to a non-shared member requires
an object reference.

The page is:

*************** *************** *************** *************** *************** *******
<%@ Page Language="VB" trace="true" debug="true" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitl ed Document</title>
</head>
<script runat="server">
sub page_load(s as object,e as eventargs)
'dim testString as String = "a test"
testLabel.text = "a test"

testLabel.text = Regex.Replace(t estLabel.text," ( and not | and )")
response.write( testLabel.text)
end sub
</script>
<body>
<asp:label id = "testLabel" runat="server"/>
</body>
</html>
*************** *************** *************** *************** *************** ********

I tried it with both testLabel.text (which is an asp:label) and also
testString (string) and got the error with both.

I do exactly the same thing in my other asp pages to make a currency value
into a decimal value.

objCmd.paramete rs.add("@WagesM in",SqlDbType.M oney).value =
Regex.Replace(W agesMin.Text,"\ $|\,","")

This works fine.

What is the difference?
I did try to put the code that doesn't work next to the one that does and it
still doesn't work.

if WagesMax.Text = "" then
objCmd.paramete rs.add("@WagesM ax",SqlDbType.M oney).value = 0.00
else
objCmd.paramete rs.add("@WagesM ax",SqlDbType.M oney).value =
Regex.Replace(W agesMax.Text,"\ $|\,","")
testLabel.text = Regex.Replace(t estLabel.text," ( and not | and )")
end if

I get the error on the testLabel.text line. The line above it works fine.

Tom
Thanks,

Tom

Nov 19 '05 #2
"tshad" <ts**********@f tsolutions.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
"tshad" <ts**********@f tsolutions.com> wrote in message
news:ue******** ******@TK2MSFTN GP09.phx.gbl...
I am trying to get a regular expression to work and I keep getting the
following error:

Compiler Error Message: BC30469: Reference to a non-shared member
requires an object reference.

The page is:

*************** *************** *************** *************** *************** *******
<%@ Page Language="VB" trace="true" debug="true" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.SqlClie nt" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitl ed Document</title>
</head>
<script runat="server">
sub page_load(s as object,e as eventargs)
'dim testString as String = "a test"
testLabel.text = "a test"

testLabel.text = Regex.Replace(t estLabel.text," ( and not | and )")
response.write( testLabel.text)
end sub
</script>
<body>
<asp:label id = "testLabel" runat="server"/>
</body>
</html>
*************** *************** *************** *************** *************** ********

I tried it with both testLabel.text (which is an asp:label) and also
testString (string) and got the error with both.

I do exactly the same thing in my other asp pages to make a currency
value into a decimal value.

objCmd.paramete rs.add("@WagesM in",SqlDbType.M oney).value =
Regex.Replace(W agesMin.Text,"\ $|\,","")

This works fine.

What is the difference?
I did try to put the code that doesn't work next to the one that does and
it still doesn't work.

if WagesMax.Text = "" then
objCmd.paramete rs.add("@WagesM ax",SqlDbType.M oney).value = 0.00
else
objCmd.paramete rs.add("@WagesM ax",SqlDbType.M oney).value =
Regex.Replace(W agesMax.Text,"\ $|\,","")
testLabel.text = Regex.Replace(t estLabel.text," ( and not | and )")
end if

I get the error on the testLabel.text line. The line above it works fine.


I found the problem.

There are 3 parameters. I had originally used an example from vbscript
which only has 2 parameters.

Thanks,

Tom
Tom

Thanks,

Tom


Nov 19 '05 #3

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

Similar topics

12
1984
by: Peter Kleiweg | last post by:
I want to use regular expressions with less typing. Like this: A / 'b.(..)' # test for regex 'b...' in A A # get the last whole match A # get the first group in the last match A /= 'b.','X',1 # replace first occurence of regex 'b.' # in A with 'X' A /= 'b.','X' # replace all occurences of regex 'b.' # in A with 'X'
16
2157
by: Andrew Baker | last post by:
I am trying to write a function which provides my users with a file filter. The filter used to work just using the VB "Like" comparision, but I can't find the equivilant in C#. I looked at RegEx.IsMatch but it behaves quite differently. Is there a way I can mimic the DOS filtering of filenames (eg. "*.*" or "*" returns all files, "*.xls" returns all excel files, "workbook*" returns all files begining with "workbook" etc)? thanks in...
6
2523
by: BigAl | last post by:
Perhaps someone here can help me out... RegEx: "^.*\d{5}(-\d{4})?.*$" Intended Purpose: To strip out the City/State/ZipCode line from a signature. Sample Text: Joe Jackson 131 W. 5th Street New York, NY 10023
17
3968
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher http://forta.com/books/0672325667/
11
1147
by: shapper | last post by:
Hello, I need to create a REGEX which accepts only phone numbers. The phone numbers start allways with 261, 21, 96 or 91 and have 7 numbers after it. Something like. 261 1223346, 21 2334456, etc. I tried the following but it is not working:
4
2182
by: Henrik Dahl | last post by:
Hello! In my application I have a need for using a regular expression now and then. Often the same regular expression must be used multiple times. For performance reasons I use the RegexOptions.Compiled when I instantiate it. It must be obvious that it takes some time to instantiate such an object. My question is, does the Regex instantiation somehow deal with some caching internally so instantiating a Regex object multiple times...
1
5620
by: al.moorthi | last post by:
the below program is working in Suse and not working on Cent 5: can any body have the solution ? #include <regex.h> #include <stdlib.h> #include <stdio.h> int main(){ char cool = "http://www.cnn.com:80/wowsers.html";
1
3282
by: mad.scientist.jr | last post by:
I am working in C# ASP.NET framework 1.1 and for some reason Regex.Split isn't working as expected. When trying to split a string, Split is returning an array with the entire string in element and an empty string in element . I am trying two different ways (an ArrayList and a string array) and both are doing that. Also, IndexOf is not working, but StartsWith does. The code:
9
6611
by: kummu4help | last post by:
can anyone give me a regex to validate the password with following conditions hope i am clear. i tried with ctype_alnum() function in php but it is accepting if all characters or either alphabet or digit. but i want to enforce atleast one alphabet and one digit should be in password can any one give me a regex for this pls.....
0
8680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5861
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
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 we have to send another system
3
2007
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.