473,800 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to create a RegularExpressi onValidator in runtime ? ?

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

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

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

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

"Ricardo Corsi P. Cesar" <rc****@webcomp any.com.br> wrote in message
news:OD******** ******@TK2MSFTN GP10.phx.gbl...
Hi, i looking for example in asp.net (VB) to make the
RegularExpressi onValidator 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 RegularExpressi onValidator
rf.ID = "rf"
rf.Enabled = True
rf.Visible = True
rf.Display = ValidatorDispla y.Dynamic
rf.ErrorMessage = "You must enter a value"
rf.Text = "*"
rf.ValidationEx pression = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
rf.ControlToVal idate = (campo.ID)
rf.EnableClient Script = True
rf.EnableViewSt ate = 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******** ******@TK2MSFTN GP11.phx.gbl...
Can you post similar code?

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

"Ricardo Corsi P. Cesar" <rc****@webcomp any.com.br> wrote in message
news:OD******** ******@TK2MSFTN GP10.phx.gbl...
Hi, i looking for example in asp.net (VB) to make the
RegularExpressi onValidator 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 RegularExpressi onValidator to work at all
because I've never needed one, but it looks like you might need to make
this change:
rf.ValidationE xpression = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" rf.ValidationEx pression = @"\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****@webcomp any.com.br>
References: <OD************ **@TK2MSFTNGP10 .phx.gbl> <O3************ **@TK2MSFTNGP11 .phx.gbl>Subject: Re: how to create a RegularExpressi onValidator 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.publi c.dotnet.framew ork.aspnet
NNTP-Posting-Host: 200-171-96-217.speedyterra .com.br 200.171.96.217
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1935 12
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet

Sure, here we go:

Public Shared Function Test(ByVal campo As TextBox)
Dim rf As New RegularExpressi onValidator
rf.ID = "rf"
rf.Enabled = True
rf.Visible = True
rf.Display = ValidatorDispla y.Dynamic
rf.ErrorMessag e = "You must enter a value"
rf.Text = "*"
rf.ValidationE xpression = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
rf.ControlToVa lidate = (campo.ID)
rf.EnableClien tScript = True
rf.EnableViewS tate = 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******* *******@TK2MSFT NGP11.phx.gbl.. .
Can you post similar code?

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

"Ricardo Corsi P. Cesar" <rc****@webcomp any.com.br> wrote in message
news:OD******** ******@TK2MSFTN GP10.phx.gbl...
> Hi, i looking for example in asp.net (VB) to make the
> RegularExpressi onValidator 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
1941
by: invincible | last post by:
hi friends , how can I declare / create function during runtime similiar to lambda in lisp. thanks Mohan
3
9146
by: takarimasu | last post by:
How can i create an input object (text area,select) at runtime ? B.
1
1973
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
1571
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 and mde formats. When I create an XP Runtime, I can't get it to work with the mde. If I create a runtime using the mdb (which I won't distribute for security reasons), it works fine. I presume it is a referencing problem, but how do I get around...
3
1316
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 the runtime version of Access (on the CD) and open the mde file (on the CD). The obvious fact is that one could not write to the CD. Not a problem. Don't need to.
17
2073
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 use any one of Access 97, 2000, 2002, 2003 or 97 runtime. So that I'm not lingering too far behind, I'm thinking of developing in 2003, using 2000 file format and distributing a 2000 mde for users of Access 2000+. (I understand I'll need to use...
2
5868
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 use template columns as they seem to be a little difficult to create at runtime. Any assistance would be very greatly appreciated. private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if...
9
4988
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
6567
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
5222
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 Language.. If You Know about this Please Reply Quick.............
0
10505
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10253
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
10033
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
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
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...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
2945
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.