Not exactly elegant, but
_entity.Fields[_entityFieldName].DataType.FullName
will return something like
"System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"
You could parse the underlying datatype out of this and then do
switch parsedDataType
{
case "DateTime":
_entity.SetNewFieldValue(_entityFieldName, Convert.ToDateTime( _textBox.Text));
break;
case "Decimal":
_entity.SetNewFieldValue(_entityFieldName, Convert.ToDecimal(_textBox.Text));
break;
etc...
}
If I can come up with anything more elegant I'll get back to you