I need to validate a string that user submit against SPField.ValidationFormula while adding new record to custom list in c#.

Line to add new record is 

SPListItem item = mylist.Items.Add();

I have formula in

column.ValidationFormula

and my string to validate is in this variable

mystringtovalidate

How can I validate mystringtovalidate against column.ValidationFormula then if is valid I'll do item.Update();


Question: Possible Genotypes of 4 Alleles of Adh
Answer: Those Hardy-Weinberg equations are the general case, used for only two alleles.  This question is basically answered here, for three alleles; you've got a situation of four alleles.  That means you need to have:

$(p+q+r+s)^2=1$

Where $p$, $q$, $r$, and $s$ are the frequencies of your respective alleles.  This expands out to the rather unwieldy:

$p^2+2pq+2pr+2ps+q^2+2qr+2qs+r^2+2rs+s^2=1$

Now it becomes a plug 'n chug assignment; simply assign the frequencies and calculate.


   Assuming $p$ is Adh-1, $q$ is Adh-2, etc., $p^2=0.0121$, $2pq=0.1848$, and so on.