Click here to Skip to main content
15,911,896 members
Home / Discussions / C#
   

C#

 
AnswerRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter28-Jan-14 20:17
professionalKornfeld Eliyahu Peter28-Jan-14 20:17 
GeneralRe: Validation and Data storing in one step Pin
nitin_ion28-Jan-14 20:27
nitin_ion28-Jan-14 20:27 
GeneralRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter28-Jan-14 20:31
professionalKornfeld Eliyahu Peter28-Jan-14 20:31 
GeneralRe: Validation and Data storing in one step Pin
nitin_ion28-Jan-14 20:38
nitin_ion28-Jan-14 20:38 
This is a win form application

i have created a class

public class ValidateProperty : Attribute
{
string _pattern;
bool _mandatory;
public ValidateProperty(string Pattern, bool Mandatory = false)
{
_pattern = Pattern;
_mandatory = Mandatory;
}

public override bool Match(object obj)
{
Match m = Regex.Match((string)obj, _pattern);
if (_mandatory == true)
{
if (string.IsNullOrWhiteSpace(m.Value)) return false;
else
{
return true;
}
}
else
return true;
}
}

and then applied on property

[ValidateProperty(@"[a-zA-Z@$^�-9\s\S]{70}",true)]
public string ClientName { get; set; }

but it is not validating when i put a string with less than 70 char. even in debug mode code is not going to match function
GeneralRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter28-Jan-14 20:41
professionalKornfeld Eliyahu Peter28-Jan-14 20:41 
GeneralRe: Validation and Data storing in one step Pin
nitin_ion28-Jan-14 20:43
nitin_ion28-Jan-14 20:43 
GeneralRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter28-Jan-14 20:45
professionalKornfeld Eliyahu Peter28-Jan-14 20:45 
GeneralRe: Validation and Data storing in one step Pin
nitin_ion28-Jan-14 20:46
nitin_ion28-Jan-14 20:46 
GeneralRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter28-Jan-14 20:50
professionalKornfeld Eliyahu Peter28-Jan-14 20:50 
GeneralRe: Validation and Data storing in one step Pin
nitin_ion28-Jan-14 23:18
nitin_ion28-Jan-14 23:18 
AnswerRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter28-Jan-14 23:21
professionalKornfeld Eliyahu Peter28-Jan-14 23:21 
GeneralRe: Validation and Data storing in one step Pin
nitin_ion28-Jan-14 23:22
nitin_ion28-Jan-14 23:22 
GeneralRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter28-Jan-14 23:31
professionalKornfeld Eliyahu Peter28-Jan-14 23:31 
GeneralRe: Validation and Data storing in one step Pin
nitin_ion28-Jan-14 23:37
nitin_ion28-Jan-14 23:37 
GeneralRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter29-Jan-14 0:16
professionalKornfeld Eliyahu Peter29-Jan-14 0:16 
GeneralRe: Validation and Data storing in one step Pin
nitin_ion29-Jan-14 21:09
nitin_ion29-Jan-14 21:09 
AnswerRe: Validation and Data storing in one step Pin
Matt T Heffron29-Jan-14 10:24
professionalMatt T Heffron29-Jan-14 10:24 
AnswerRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter29-Jan-14 21:49
professionalKornfeld Eliyahu Peter29-Jan-14 21:49 
GeneralRe: Validation and Data storing in one step Pin
Matt T Heffron30-Jan-14 6:38
professionalMatt T Heffron30-Jan-14 6:38 
GeneralRe: Validation and Data storing in one step Pin
Kornfeld Eliyahu Peter30-Jan-14 6:42
professionalKornfeld Eliyahu Peter30-Jan-14 6:42 
QuestionHighlight Text in html document Pin
Sumit Rastogi SRA27-Jan-14 20:27
professionalSumit Rastogi SRA27-Jan-14 20:27 
QuestionRe: Highlight Text in html document Pin
Richard MacCutchan27-Jan-14 22:18
mveRichard MacCutchan27-Jan-14 22:18 
AnswerRe: Highlight Text in html document Pin
Sumit Rastogi SRA27-Jan-14 22:57
professionalSumit Rastogi SRA27-Jan-14 22:57 
AnswerRe: Highlight Text in html document Pin
OriginalGriff27-Jan-14 22:27
mveOriginalGriff27-Jan-14 22:27 
GeneralRe: Highlight Text in html document Pin
Sumit Rastogi SRA27-Jan-14 22:57
professionalSumit Rastogi SRA27-Jan-14 22:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.