473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

how to create a RegularExpressionValidator in runtime ? ?

Hi, i looking for example in asp.net (VB) to make the
RegularExpressionValidator in runtime in my code behind.

I found some similars codes, but nothing in VB..

thanks!
Nov 18 '05 #1
3 3768
Can you post similar code?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"Ricardo Corsi P. Cesar" <rc****@webcompany.com.br> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
Hi, i looking for example in asp.net (VB) to make the
RegularExpressionValidator in runtime in my code behind.

I found some similars codes, but nothing in VB..

thanks!

Nov 18 '05 #2
Sure, here we go:

Public Shared Function Test(ByVal campo As TextBox)
Dim rf As New RegularExpressionValidator
rf.ID = "rf"
rf.Enabled = True
rf.Visible = True
rf.Display = ValidatorDisplay.Dynamic
rf.ErrorMessage = "You must enter a value"
rf.Text = "*"
rf.ValidationExpression = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
rf.ControlToValidate = (campo.ID)
rf.EnableClientScript = True
rf.EnableViewState = False
rf.Validate = campo
End Function

but this code above, it seems to do nothing when i use it on a button (on
click event). Something is missing to this simple code work fine.

could you help me up ?

"Miha Markic" <miha at rthand com> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
Can you post similar code?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"Ricardo Corsi P. Cesar" <rc****@webcompany.com.br> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
Hi, i looking for example in asp.net (VB) to make the
RegularExpressionValidator in runtime in my code behind.

I found some similars codes, but nothing in VB..

thanks!


Nov 18 '05 #3
I'm having trouble getting a RegularExpressionValidator to work at all
because I've never needed one, but it looks like you might need to make
this change:
rf.ValidationExpression = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" rf.ValidationExpression = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"

That magical "@" will make the "\" chars in your regexp literal instead of
escape characters.

If you are still having trouble, let me know and I will dig deaper to see
if I can get you a solid example.

----------------
This posting is provided "AS IS" with no warranties, and
confers no rights.

Please do not send e-mail directly to this alias. This
alias is for newsgroup purposes only.

Thanks
Nick

--------------------From: "Ricardo Corsi P. Cesar" <rc****@webcompany.com.br>
References: <OD**************@TK2MSFTNGP10.phx.gbl> <O3**************@TK2MSFTNGP11.phx.gbl>Subject: Re: how to create a RegularExpressionValidator in runtime ? ?
Date: Wed, 26 Nov 2003 13:41:29 -0200
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <eG**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 200-171-96-217.speedyterra.com.br 200.171.96.217
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:193512
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Sure, here we go:

Public Shared Function Test(ByVal campo As TextBox)
Dim rf As New RegularExpressionValidator
rf.ID = "rf"
rf.Enabled = True
rf.Visible = True
rf.Display = ValidatorDisplay.Dynamic
rf.ErrorMessage = "You must enter a value"
rf.Text = "*"
rf.ValidationExpression = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
rf.ControlToValidate = (campo.ID)
rf.EnableClientScript = True
rf.EnableViewState = False
rf.Validate = campo
End Function

but this code above, it seems to do nothing when i use it on a button (on
click event). Something is missing to this simple code work fine.

could you help me up ?

"Miha Markic" <miha at rthand com> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
Can you post similar code?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"Ricardo Corsi P. Cesar" <rc****@webcompany.com.br> wrote in message
news:OD**************@TK2MSFTNGP10.phx.gbl...
> Hi, i looking for example in asp.net (VB) to make the
> RegularExpressionValidator in runtime in my code behind.
>
> I found some similars codes, but nothing in VB..
>
> thanks!
>
>




Nov 18 '05 #4

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

Similar topics

5
by: invincible | last post by:
hi friends , how can I declare / create function during runtime similiar to lambda in lisp. thanks Mohan
3
by: takarimasu | last post by:
How can i create an input object (text area,select) at runtime ? B.
1
by: SAN CAZIANO | last post by:
how can i create a runtime table and define a new field to allow null value and set the rquired to true or false ???
7
by: Bob Darlington | last post by:
I've got the Stephen Lebans Report Utilities add in as a reference (A2KReportSpecs.mde ) so that I can export Access 2002 reports to rft instead of Snapshots. It works fine in my app in both mdb...
3
by: MLH | last post by:
More to the point... Is it possible for me to install a runtime set of A97 executables onto a CD, give it to some- one, let them pop it into their PC, dbl-click an icon on CD and have it launch...
17
by: Owen Jenkins | last post by:
I have an Access application that is being used by 150+ clients. I develop in 97, convert to 2000 and distribute as a 97 or 2000 mde, or 97 runtime. This limits me to 97 functions. My clients may...
2
by: Steve Pierce | last post by:
I am having some issues with a runtime dropdownlist in a datagrid. The issue is that I cannot get ViewState to fill the selected index of a runtime dropdown properly on postback. I do not want to...
9
by: Helly | last post by:
I know this might sound like a silly question but can someone explain to me what Runtime is or how it's used? thanks Helly
2
by: manivelk | last post by:
Hi, i want to know how to display the table control at runtime data entry type.. If any one knows plz help me.. Thanks in advance.. Regards, Manivel. K
2
by: varunkumarid | last post by:
Hai to all, Suppose The Database Table is Deleted by someone, I want to check the Table Either Exist or not and then create the Dynamic Database at the Project Runtime in sql Using the VB.Net...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...

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.