Hey Michael,
I have seen you posting several duplicate topics as well as intermingling topics. Please try to keep the forum organized by refraining from these activities. Below is a sample code snippet of this functionality in C#.NET:
// The following function handler is created by Microsoft Office InfoPath. Do not
// modify the type or number of arguments.
[InfoPathEventHandler(MatchPath="/my:CustomerAdmin/my:Customers/my:Customer/my:Contacts/my:Contact/my:Email", EventType=InfoPathEventType.OnBeforeChange)]
public void Email_OnBeforeChange(DataDOMEvent e)
{
// Write your code here. Warning: ensure that the constraint you are enforcing is
// compatible with the default value you set for this XML node.
string[] badStrings = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
bool badNewValue = false;
for (int i = 0; i < badStrings.Length; i++)
{
if (e.NewValue.ToString().Contains(badStrings))
{
badNewValue = true;
break;
}
}
if (badNewValue)
{
e.ReturnMessage = "You may not enter numeric characters in this field.";
e.ReturnStatus = false;
}
}
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge