PC Review


Reply
Thread Tools Rate Thread

Design-Time Validation for positive integers

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      20th Oct 2009
I have several properties in my custom control that I only want to allow
positive values for. Because the unsigned integral types (such as UInteger,
UShort, etc.) are not CLS compliant, it gives an error when run. Is there a
way to validate that only positive values were entered if I use the signed
types? Thanks.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
James Hahn
Guest
Posts: n/a
 
      21st Oct 2009
Create your own class of validated positive integer, and create a custom
converter for the type. The custom converter can return 'invalid' for any
string that would convert to a negative integer.

For details on custom converters, see:

http://msdn.microsoft.com/en-us/library/ayybcxe5.aspx

"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have several properties in my custom control that I only want to allow
>positive values for. Because the unsigned integral types (such as UInteger,
>UShort, etc.) are not CLS compliant, it gives an error when run. Is there a
>way to validate that only positive values were entered if I use the signed
>types? Thanks.
> --
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Design-Time Validation for positive integers Nathan Sokalski Microsoft VB .NET 1 21st Oct 2009 05:00 AM
adding positive integers in a column or row jason7100 Microsoft Excel Misc 2 23rd Nov 2004 06:19 AM
I need positive integers only! Cameron Sutherland Microsoft Access Queries 2 18th Sep 2003 08:13 PM
Positive Integers Only ExcessAccess Microsoft Access Queries 4 11th Sep 2003 02:32 AM
Re: I need positive integers only! Jeff Boyce Microsoft Access Queries 0 9th Sep 2003 01:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:45 PM.